This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
95 lines (91 loc) · 2.58 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var jq_location = path.join(__dirname, 'node_modules/jquery');
module.exports = {
mode: 'development',
devtool: '#source-map',
context: __dirname,
optimization: {
splitChunks: {
cacheGroups: {
default: false,
commons: {
test: /node_modules/,
name: "vendor",
chunks: "initial",
minSize: 1
}
}
}
},
entry: {
javascript: './src/main.js'.replace("/", path.sep)
},
resolve: {
alias: {
},
symlinks: false
},
devServer: {
disableHostCheck: true
},
output: {
path: path.join(__dirname, "dist"),
publicPath: "",
filename: "[name]-[hash].js",
chunkFilename: "[name]-[chunkhash].js",
hotUpdateMainFilename: "[hash]/update.json".replace("/", path.sep),
hotUpdateChunkFilename: "[hash]/js/[id].update.js".replace("/", path.sep)
},
module: {
rules: [
{
test: /\.(ttf|eot|svg|mp3|png|jpg|woff(2)?)(.*)?$/,
loader: 'file-loader'
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.txt$/,
use: 'raw-loader'
},
{
test: /\.html$/,
exclude: /(node_modules|bower_components)/,
loader: "html-loader?attrs[]=source:src&attrs[]=img:src&attrs[]=section:data-image-src"
},
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
options: {
presets: ['es2015', 'stage-0'],
plugins: ['transform-runtime', "angularjs-annotate"],
cacheDirectory: true
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
'window.jQuery': jq_location,
'jQuery': jq_location,
$: jq_location
}),
new HtmlWebpackPlugin({
template: 'index.ejs',
inject: 'body',
filename: 'index.html'
}),
new webpack.DefinePlugin({
DEBUG: true,
'typeof global': JSON.stringify('undefined')
})
]
};