forked from formio/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
88 lines (88 loc) · 2.88 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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var webpack = require("webpack");
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
exports.default = (function (environment) {
if (environment === void 0) { environment = 'development'; }
return {
mode: 'development',
devtool: 'eval',
entry: path.join(__dirname, 'demo', 'entry.ts'),
output: {
filename: '[name].js'
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'tslint-loader',
exclude: /node_modules/,
enforce: 'pre'
},
{
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: true
}
},
{
test: /\.html$/,
loader: 'html-loader',
options: {
attrs: [':data-src']
}
},
{
test: /\.scss$/,
use: [{
loader: 'style-loader' // creates style nodes from JS strings
}, {
loader: 'css-loader' // translates CSS into CommonJS
}, {
loader: 'sass-loader' // compiles Sass to CSS
}]
},
{
test: /\.(svg|png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192
}
}
]
}
]
},
resolve: {
extensions: ['.ts', '.js']
},
devServer: {
// host: '0.0.0.0', // for Docker development
port: 8000,
inline: true,
hot: true,
historyApiFallback: true,
overlay: true
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ForkTsCheckerWebpackPlugin({
watch: ['./src', './demo'],
formatter: 'codeframe'
}),
new webpack.DefinePlugin({
ENV: JSON.stringify(environment)
}),
new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)fesm5/, path.join(__dirname, 'src')),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'demo', 'index.ejs')
})
]
};
});