This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
80 lines (67 loc) · 1.91 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
context: path.resolve('js'),
entry: __dirname + "/src/app/app.js",
output: {
path: __dirname + "/src/build/",
filename: "bundled.js"
},
plugins: [ // Array of plugins to apply to build chunk
new HtmlWebpackPlugin({
template: __dirname + "/src/public/index.html",
inject: 'body'
})
],
optimization: {
minimizer: [
new UglifyJsPlugin({
test: /\.js($|\?)/i,
})
]
},
devServer: { // configuration for webpack-dev-server
contentBase: __dirname + '/src/public', //source of static assets
port: 7700, // port to run dev-server
},
mode: 'production',
module: {
rules: [
{
test: /\.js$/,
exclude: [/server/, /node_modules/],
use: [
{
loader: 'ng-annotate-loader',
},
{
loader: "babel-loader"
}
]
},
{
test: /\.html$/,
exclude: /node_modules/,
loader: "raw-loader"
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.(png|jp(e*)g|svg)$/,
use: [{
loader: 'url-loader',
options: {
limit: 8000, // Convert images < 8kb to base64 strings
name: 'images/[hash]-[name].[ext]'
}
}]
}
]
},
resolve: {
extensions: ['.js', '.es6']
}
};