-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
79 lines (76 loc) · 2.15 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
var path = require("path");
var open = require("open");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require("webpack");
//a little bit of glitch before page opens,
//works well otherwise
open("http://localhost:8080/");
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080',
path.resolve(__dirname, 'src/app/main.ts')
],
output: {
path: path.resolve(__dirname, './dist/js'),
publicPath: 'js',
filename: 'bundle.js'
},
resolve: {
extensions: [".js", ".json", ".ts"]
},
performance: { hints: false },
devtool: "#eval-source-map",
plugins: [
new webpack.LoaderOptionsPlugin({
test: /\.tsx?$/,
options: {
eslint: {
configFile: path.join(__dirname, '.eslintrc')
},
debug: true,
resolve: {
extensions: ['', '.ts', '.tsx']
},
resolveLoader: {
modules: ['node_modules', __dirname + '/client/node_modules'],
}
}
}),
new HtmlWebpackPlugin({
title: 'Webpack Starter Angular',
template: 'dist/index.html',
minify: {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
})
],
module: {
rules: [
{
test: /\.tsx?$/,
use: ['eslint-loader', 'ts-loader'],
exclude: /(node_modules)/
},
{
test: /\.pug/,
use: 'pug-html-loader'
},
{
test: /\.html$/,
use: "html-loader"
},
{
test: /\.scss$/,
use: ["style-loader", "css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]", "autoprefixer-loader", "sass-loader"]
},
{
test: /\.css$/,
use: ["style-loader", "css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]"]
}
]
}
};