-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.bundle.js
50 lines (45 loc) · 1.52 KB
/
webpack.bundle.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
const common = require("./webpack.common");
const merge = require("webpack-merge");
const HtmlPlugin = require('html-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
const XMLWebpackPlugin = require("xml-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const pkg = require("./package.json");
const path = require("path");
const xmlConfig = env => {
return {
files: [{
template: path.join(__dirname, "tizen", "config.ejs"),
filename: 'config.xml',
data: {
version: pkg.version,
appId: pkg.tizen.appId,
appName: pkg.tizen.appName,
package: pkg.tizen.package,
additionalPrivileges: (env && env.FILE_LOGGER) ? ["filesystem.read", "filesystem.write"] : []
}
}]
}
};
const templateParameters = {
appName: pkg.tizen.appName,
devChrome: false
};
module.exports = env => {
return merge(common(env), {
devtool: "source-map",
plugins: [
new HtmlPlugin({
filename: 'index.html',
template: 'src/index.ejs',
chunks: ['vendors', 'main'],
templateParameters
}),
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'defer'
}),
new XMLWebpackPlugin(xmlConfig(env)),
// new BundleAnalyzerPlugin({analyzerMode: 'server'})
]
});
};