This repository has been archived by the owner on Dec 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
77 lines (73 loc) · 1.72 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
74
75
76
77
/* global __dirname, require, module*/
const webpack = require('webpack')
const path = require('path')
const entry = require('webpack-glob-entry')
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
let srcPath = __dirname + '/src'
const config = {
entry: {
rpg_core: srcPath + '/rpg_core.js',
rpg_windows: srcPath + '/rpg_windows.js'
},
devtool: 'cheap-source-map',
output: {
path: __dirname + '/build',
pathinfo: true,
filename: '[name].js',
// library: ['[name]'],
// libraryExport: '[name]',
// libraryTarget: 'window',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [
{
test: /\.(js)$/,
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/,
options: {
presets: [
[
'env',
{
targets: {
browser: 'current'
},
modules: false
}
]
],
cacheDirectory: true,
plugins: [
'babel-plugin-add-module-exports',
'transform-class-properties',
'transform-object-rest-spread'
]
}
}
]
},
resolve: {
modules: [path.resolve('./node_modules'), path.resolve('./src')],
extensions: ['.json', '.js']
},
devServer: {
contentBase: path.join(__dirname),
compress: true,
port: 9000,
overlay: {
warnings: true,
errors: true
},
watchContentBase: true,
watchOptions: {
poll: true
}
},
externals: {
'nw.gui': ''
},
plugins: [new webpack.NamedModulesPlugin(), new CaseSensitivePathsPlugin()]
}
module.exports = config