-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.build.config.js
75 lines (66 loc) · 1.87 KB
/
webpack.build.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
var path = require("path");
var webpack = require("webpack");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var Clean = require('clean-webpack-plugin');
var distPaths = {
scripts: "js/",
images: "img/"
}
//Config
module.exports = {
devtool: "source-map",
debug: true,
devServer: {
historyApiFallback: true,
contentBase: "http://localhost/",
inline:"true",
publicPath: "/"
},
entry: {
app: "./app/app.ts",
vendor: [
"jquery",
"angular"
]
},
output: {
path: path.join( __dirname, "dist"),
filename: distPaths.scripts + "[name]-[hash].min.js",
},
resolve: {
extensions: ["",".ts",".js", ".json", ".css", ".html"]
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json' },
{ test: /\.less$/, loader: "style!css!less-loader"},
{test: /\.(png|jpg)$/, loader: 'url?prefix=img/&name=img/[hash].[ext]&limit=8192'}, // inline base64 URLs for <=8k images, direct URLs for the rest
{ test: /\.html$/, loader: 'html' },
// Support for .ts files.
{
test: /\.ts$/,
loader: 'ts',
query: {
'ignoreDiagnostics': [
2403, // 2403 -> Subsequent variable declarations
2300, // 2300 Duplicate identifier
2374, // 2374 -> Duplicate number index signature
2375 // 2375 -> Duplicate string index signature
]},
exclude: [ /\.spec\.ts$/, /\.e2e\.ts$/, /node_modules/ ]
}
]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.NoErrorsPlugin(),
new Clean(['dist']),
new HtmlWebpackPlugin({
title: 'Angular 1.x Typescript Webpack Seed',
template: 'index.html',
inject: 'body'
})
]
}