-
Notifications
You must be signed in to change notification settings - Fork 11
/
webpack.config.js
56 lines (52 loc) · 1.27 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 webpack = require('webpack');
const path = require('path');
const appPath = path.join(__dirname, 'app');
const distPath = path.join(__dirname, 'dist');
const exclude = [/node_modules/];
const CleanPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = {
context: appPath,
entry: {
app: './main.js'
},
output: {
path: distPath,
publicPath: '/',
filename: 'bundle.[hash].js'
},
plugins: [
// Generate index.html with included script tags
new HtmlWebpackPlugin({
inject: 'body',
template: './template.html'
}),
// Remove all files in dist before creating a production package
new CleanPlugin(['dist'])
],
module: {
noParse: [/app\/bin/],
loaders: [
{ test: require.resolve('three'),
loader: 'expose?THREE'
},
{
test: /.jsx?$/,
exclude: exclude,
loader: 'babel'
}
]
},
devServer: {
contentBase: './app'
},
resolve: {
root: [
path.resolve('./app')
]
},
node: {
fs: 'empty'
}
};
module.exports = config;