-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
37 lines (37 loc) · 1.12 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
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const cssModules = 'modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]'
module.exports = {
resolve: {
extensions: ['.js', '.jsx', '.css']
},
entry: './src/index.jsx',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/'
},
module: {
rules: [
{ test: /(\.js|jsx)$/, exclude: /node_modules/, loaders: ['babel-loader'] },
{ test: /\.css$/, loader: `style-loader!css-loader?${cssModules}` },
{
test: /\.scss$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader?modules&importLoader=2&sourceMap&localIdentName=[name]__[local]___[hash:base64:5]!sass-loader'
})
}
]
},
devServer: {
historyApiFallback: true,
port: 8080
},
plugins: [
new HtmlWebpackPlugin({ template: './src/assets/index.html' }),
new ExtractTextPlugin('style.css', { allChunks: true })
]
}