-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
42 lines (35 loc) · 1.27 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
42
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
// the starting point for our program
// entry: ['./src/index.js', './scss/main.scss'],
entry: ['./src/index.js'],
// affects several default webpack settings
mode: 'development',
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: '[name].css',
chunkFilename: '[id].css'
})
],
output: {
// The absolute path for the directory where we want the output to be placed.
// Whenever we need an absolute path, it's a best practice to use the built-in
// `path` module
path: path.join(__dirname, '/public'),
// The name of the file that will contain our output.
// We could name this whatever we want, but bundle.js is typical
filename: 'bundle.js'
},
// Creates "source map" files (ex. "bundle.js.map"). Modern browsers can automatically
// request these to "rebuild" your original source code in your dev tools (i.e. the Sources tab).
// This makes debugging much, much nicer
devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, '/public'),
compress: true,
port: 5050
}
};