forked from charlieysx/bearjump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
59 lines (50 loc) · 1.53 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
const os = require('os');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
entry: {
game: ['core-js/modules/es.array.iterator', '@iro/wechat-adapter', path.resolve(__dirname, 'src/game/app.js')],
'openDataContext/index': [path.resolve(__dirname, 'src/openDataContext/app.js')]
},
output: {
path: path.resolve(__dirname, 'dist/root'),
filename: '[name].js'
},
resolve: {
alias: {
'@': path.resolve('.')
}
},
devtool: isProd ? false : 'source-map',
stats: 'errors-only',
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader'],
exclude: /node_modules/
},
{
test: /\.(vert|frag)$/,
use: ['raw-loader']
}
]
},
plugins: [
new CleanWebpackPlugin(),
new webpack.ProvidePlugin({
dayjs: 'dayjs',
PIXI: 'pixi.js',
}),
new CopyWebpackPlugin([
{ from: 'src/cloud', to: '../cloud' },
{ from: 'src/project.config.json', to: '../project.config.json' },
{ from: 'src/game.json', to: 'game.json' },
{ from: 'src/static/dist', to: 'static' }
])
],
mode: isProd ? 'production' : 'development'
};