-
Notifications
You must be signed in to change notification settings - Fork 19
/
webpack.config.js
59 lines (55 loc) · 1.9 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
'use strict';
var webpack = require('webpack');
var Clean = require('clean-webpack-plugin');
var Path = require('path');
var FileSystem = require("fs");
var DIST = Path.join(__dirname, 'src/main/webapp/assets/dist/');
module.exports = {
node: {
fs: "empty"
},
entry: {
style: Path.join(__dirname, 'src/main/webapp/WEB-INF/assets/style.js'),
script: Path.join(__dirname, 'src/main/webapp/WEB-INF/assets/script.js'),
ja: Path.join(__dirname, 'src/main/webapp/WEB-INF/assets/ja.js'),
en: Path.join(__dirname, 'src/main/webapp/WEB-INF/assets/en.js')
},
output: {
path: DIST,
filename: '[name].[hash].js',
publicPath: '/assets/dist/'
},
resolve: {
modules: ['node_modules', 'dl_modules'],
alias: {
'jquery-ui': 'jquery-ui/ui/widgets',
'jquery-ui-css': 'jquery-ui/../../themes/base'
}
},
module: {
rules: [
{ test: /\.(jpg|png)$/, loader: "file-loader" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file-loader" },
{ test: /\.(woff|woff2)$/, loader:"url-loader?prefix=font/&limit=5000" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=application/octet-stream" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=image/svg+xml" }
]
},
devtool: '#source-map',
plugins: [
new Clean([DIST]),
// generate hash
function() {
this.plugin("done", function(statsData) {
var stats = statsData.toJson();
if (!stats.errors.length) {
FileSystem.writeFileSync(
Path.join(DIST, 'version.txt'),
stats.hash
);
}
});
},
new webpack.optimize.UglifyJsPlugin()
]
};