forked from brenapp/digit-recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
executable file
·52 lines (49 loc) · 1.35 KB
/
webpack.config.js
File metadata and controls
executable file
·52 lines (49 loc) · 1.35 KB
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
const webpack = require("webpack");
const failPlugin = require("webpack-fail-plugin");
const tslint = require("tslint-loader");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const isProd = process.env.NODE_ENV === "production";
var prodPlugins = [];
//plugins that are only used for prod builds
if (isProd) {
console.log("Building prod version...");
prodPlugins = [new webpack.optimize.UglifyJsPlugin()];
}
module.exports = {
entry: "./src/main.ts",
output: {
filename: "./dist/main.js"
},
// Turn on sourcemaps
devtool: "source-map",
resolve: {
extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"]
},
plugins: [failPlugin].concat(prodPlugins),
module: {
loaders: [
{ test: /\.ts$/, loader: "ts-loader" },
{
test: /\.worker\.js$/,
loader: "workerize-loader"
},
// { test: /\.css$/, loader: "style!css" }, // CSS
{ test: /\.less$/, loader: "style!css!less" }, //LESS https://github.com/webpack/less-loader
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: "file?name=dist/fonts/[name].[ext]"
}, // Fonts
{ test: /\.(jpg|png|svg)$/, loader: "file?name=dist/images/[name].[ext]" } // Images
],
preLoaders: [
{
test: /\.ts$/,
loader: "tslint"
}
]
},
tslint: {
emitErrors: true,
failOnHint: true
}
};