-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
41 lines (40 loc) · 1.17 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './front-end/index.js', // path to our input file
output: {
filename: 'main.js', // output bundle file name
path: path.resolve(__dirname, './static'), // path to our Django static directory
},
module: {
rules: [
{ // React files loader with Babel
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader",
options: { presets: ["@babel/preset-env", "@babel/preset-react"] }
},
{ // Global SCSS/CSS + React SCSS/CSS Modules
test: /\.s?css$/,
oneOf: [
{
test: /\.module\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
//options: { modules: true, exportOnlyLocals: false }
options: { modules: true }
},
"sass-loader"
]
},
{
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"]
}
]
},
]
},
plugins: [new MiniCssExtractPlugin()]
};