-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.js
More file actions
58 lines (47 loc) · 1.48 KB
/
webpack.config.js
File metadata and controls
58 lines (47 loc) · 1.48 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
const webpack = require('webpack');
const path = require('path');
const ENV = process.env.NODE_ENV || 'development';
module.exports = {
mode: ENV,
context: path.resolve(__dirname, 'app/redux/'),
entry: './index.js',
output: {
path: path.resolve(__dirname, 'public/js'),
publicPath: '/js/',
filename: 'bundle.js'
},
resolve: {
modules: [
path.join(__dirname, 'app/redux'),
'node_modules'
],
extensions: ['.jsx', '.js', '.json']
},
module: {
rules: [
{test: /\.js$/, use: ['babel-loader'], exclude: /node_modules/},
{test: /\.(xml|html|txt|md)$/, use: 'raw-loader'},
{
test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
use: ENV === 'production' ? 'file-loader?name=[path][name]_[hash:base64:5].[ext]' : 'url-loader'
},
{test: /\.css$/, use: ['style-loader', 'css-loader']},
{test: /\.scss$/, use: ['style-loader', 'css-loader', "sass-loader"]}
]
},
plugins: ([
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(ENV)
})
]),
stats: {colors: true},
node: {
global: true,
process: false,
Buffer: false,
__filename: false,
__dirname: false,
setImmediate: false
}
};