-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
73 lines (72 loc) · 1.81 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const htmlWebpackPlugin = new HtmlWebpackPlugin({
template: path.join(__dirname, 'demo/index.html'),
filename: './index.html'
});
const isDev = process.argv.indexOf('serve') > -1 ? true : false;
module.exports = {
entry: './demo/index.js',
mode: isDev ? 'development' : 'production',
output: {
path: path.join(__dirname, 'demo/dist'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: {
loader: 'babel-loader',
},
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', 'sass-loader',
],
},
],
},
plugins: [
htmlWebpackPlugin,
new CopyWebpackPlugin({
patterns: [
{ from: './public' }
]
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
})
],
resolve: {
extensions: ['.js', '.jsx'],
alias: {
"@Components": path.resolve(__dirname, 'src/components'),
"@TestData": path.resolve(__dirname, 'src/test_data'),
"@Services": path.resolve(__dirname, 'src/services'),
styles: path.resolve(__dirname, 'src/styles'),
context: path.resolve(__dirname, 'src/context'),
},
fallback: {
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer'),
}
},
devServer: {
host: '0.0.0.0',
port: 3003,
liveReload: true,
static: {
directory: path.resolve(__dirname, "public")
}
},
devtool: 'source-map',
};