-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
45 lines (43 loc) · 1.14 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
43
44
45
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const config = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
// filename: '[chunkhash].js',
// chunkFilename: '[chunkhash].js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.scss$/,
exclude: /node_modules/,
loader: ExtractTextPlugin.extract({
loader: 'css-loader?sourceMap!sass-loader?sourceMap',
}),
},
],
},
devtool: 'eval-source-map', // works correctly
// devtool: 'cheap-module-eval-source-map', // doesn't work correctly
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
compress: true,
port: 9000,
},
plugins: [
new ExtractTextPlugin({ filename: 'bundle.css', disable: false, allChunks: true }),
new HtmlWebpackPlugin({
template: './src/index.ejs',
}),
],
};
module.exports = config;