-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
44 lines (43 loc) · 997 Bytes
/
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
42
43
44
const path = require( 'path' )
const env = process.env.NODE_ENV
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' )
// Let's put our configuration together
module.exports = {
entry: {
bundle: './assets/js/main.js'
},
output: {
filename: '[name].js',
path: path.resolve( __dirname, 'dist' ),
},
mode: env,
stats: {
children: false,
},
module: {
// Pass in our loaders to handle file types appropriately
rules: [
// Run our JS through babel for ES6 and JS Modules support
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
},
},
// Handle our .css files through our loaders
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']
},
]
},
plugins: [
// Tell webpack to output our CSS to a separate file, not within our JS
new MiniCssExtractPlugin( {
filename: '[name].css',
chunkFilename: '[id].css'
} ),
],
}