-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
58 lines (53 loc) · 1.14 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
var path = require('path');
var webpack = require("webpack");
var dist = JSON.parse(process.env.PROD_ENV || '0');
var plugins = [];
var entry = {
"craft": './src/index.js',
}
if(dist){
plugins = plugins.concat([
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
compress: false
})
])
entry["craft.min"] = './src/index.js';
}
module.exports = {
entry,
plugins,
output: {
library:'craft',
filename: 'build/phaser-[name].js',
sourceMapFilename: '[file].map',
umdNamedDefine: true,
devtoolModuleFilenameTemplate: "webpack:///[resource-path]", // string
devtoolFallbackModuleFilenameTemplate: "webpack:///[resource-path]?[hash]", // string
libraryTarget:'umd'
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
use:[
{
loader: 'babel-loader',
// query: {
// babelrc:false,
// presets: [ path.join(__dirname,'node_modules/babel-preset-es2015') ]
// }
},
]
},
{ test: /\.json\.js/, exclude: /node_modules/, loader: 'tojson-loader'}
]
},
externals:{
phaser: "Phaser",
Phaser: "Phaser",
},
};