-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.prod.js
68 lines (66 loc) · 1.68 KB
/
webpack.prod.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
const path = require('path');
const WebpackAutoInject = require('webpack-auto-inject-version');
const Entities = require('html-entities').AllHtmlEntities;
const HandlebarsPlugin = require("handlebars-webpack-plugin");
const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');
const entities = new Entities();
module.exports = {
entry: {
"bootstrap-select-dropdown" : "./src/dist.js"
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: "[name].min.js"
},
externals: {
"fuse.js": 'Fuse',
jquery: '$'
},
module: {
rules: [
{
test: /\.js$/,
exclude: [path.resolve('node_modules')],
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
plugins: [
new WebpackAutoInject({
components: {
AutoIncreaseVersion: false,
InjectAsComment: false
}
}),
new HandlebarsPlugin({
entry: path.join(process.cwd(), "src", "views", "*.hbs"),
output: path.join(process.cwd(), "docs", "[name].html"),
data: require("./src/views/data.json"),
partials: [
path.join(process.cwd(), "src", "views", "partials", "*", "*.hbs")
],
helpers: {
htmlentities: function(context, options) {
return entities.encode( context );
},
jsonoption: function(value) {
if (value == 'boolean_false') {
return 'false';
}
if (value == 'boolean_true') {
return 'true';
}
return value;
}
}
}),
new UnminifiedWebpackPlugin({
//include: /\.js$/i
})
]
};