forked from grommet/grommet-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
56 lines (51 loc) · 1.09 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
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const useAlias = process.env.USE_ALIAS;
const plugins = [
new CopyWebpackPlugin([{ from: './public' }]),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
];
let alias;
if (useAlias) {
console.log('Using alias to local grommet.');
alias = {
'grommet': path.resolve(__dirname, '../grommet/src/js'),
'grommet-icons': path.resolve(__dirname, '../grommet-icons/src/js'),
};
}
module.exports = {
devtool: 'hidden-source-map',
devServer: {
contentBase: './dist',
historyApiFallback: true,
hot: true,
port: 8576,
},
entry: './src/index.js',
output: {
path: path.resolve('./dist'),
filename: 'index.js',
publicPath: '/',
},
resolve: {
alias,
extensions: ['.js', '.json'],
},
plugins,
node: {
fs: 'empty',
net: 'empty',
tls: 'empty',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
};