1const path = require('path')
2module.exports = {
3 mode: "production",
4 entry: './src/index.js',
5 output: {
6 path: path.resolve(__dirname, 'dist'),
7 filename: 'bundle.js',
8 },
9 module: {
10 rules: [
11 {
12 test: /\.jsx?$/,
13 exclude: /(node_modules)/,
14 use: {
15 loader: 'babel-loader',
16 options: {
17 presets: ['@babel/preset-react']
18 }
19 }
20 },
21 {
22 test: /\.s[ac]ss$/i,
23 use: [
24 // Creates `style` nodes from JS strings
25 "style-loader",
26 // Translates CSS into CommonJS
27 "css-loader",
28 // Compiles Sass to CSS
29 "sass-loader",
30 ],
31 },
32 {
33 test: /\.css$/i,
34 use: [
35 "style-loader",
36 "css-loader",
37 {
38 loader: "postcss-loader",
39 options: {
40 postcssOptions: {
41 plugins: [
42 [
43 "postcss-preset-env",
44 {
45 // Options
46 },
47 ],
48 ],
49 },
50 },
51 },
52 ],
53 }
54 ]
55 }
56 }