-
Notifications
You must be signed in to change notification settings - Fork 349
/
Copy pathwebpack.common.js
45 lines (44 loc) · 1.16 KB
/
webpack.common.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 path = require('path')
const webpack = require('webpack')
const ESLintPlugin = require('eslint-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: ['index.js'],
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
module: {
rules: [
{ test: /\.css$/i, use: ['style-loader', 'css-loader'] },
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{
test: /\.jpe?g$|\.ico$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
loader: 'file-loader',
options: {
name: '[name].[ext]'
}
}
]
},
plugins: [
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
new webpack.ProvidePlugin({ process: ['process'] }),
new ESLintPlugin()
],
performance: {
hints: process.env.NODE_ENV === 'production' ? 'warning' : false
},
resolve: {
modules: [
path.join(__dirname, 'src'),
'node_modules'
],
fallback: {
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve("buffer/"),
}
}
}