Answers for "webpack react + postcss"

0

webpack react + postcss

const path = require('path')
module.exports = {
    mode: "production",
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js',
    },
    module: {
      rules: [
        {
            test: /\.jsx?$/,
            exclude: /(node_modules)/,
            use: {
                loader: 'babel-loader',
                options: {
                    presets: ['@babel/preset-react']
                }
            }
        },
        {
            test: /\.s[ac]ss$/i,
            use: [
                // Creates `style` nodes from JS strings
                "style-loader",
                // Translates CSS into CommonJS
                "css-loader",
                // Compiles Sass to CSS
                "sass-loader",
            ],
        },
        {
            test: /\.css$/i,
            use: [
                "style-loader",
                "css-loader",
                {
                loader: "postcss-loader",
                options: {
                    postcssOptions: {
                    plugins: [
                        [
                            "postcss-preset-env",
                            {
                                // Options
                            },
                        ],
                    ],
                    },
                },
                },
            ],
        }
      ]
    }
  }
Posted by: Guest on June-15-2021

Code answers related to "webpack react + postcss"

Code answers related to "Javascript"

Browse Popular Code Answers by Language