-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
83 lines (79 loc) · 1.66 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
const path = require('path');
const sourcePath = path.join(__dirname, './demo');
const destPath = path.join(__dirname, './dist');
let HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './demo/index.ts',
output: {
filename: 'bundle.js',
path: destPath
},
module: {
loaders: [
{
test: /\.html/,
loader: 'html-loader'
}
],
rules: [
{
//html gets loaded into javascript land
test: /\.(html|ejs)$/,
exclude: /node_modules/,
loader: 'html-loader',
options: {
root: sourcePath,
// https://github.com/webpack-contrib/html-loader/issues/67
// https://www.npmjs.com/package/html-minifier
removeAttributeQuotes: false,
keepClosingSlash: true,
caseSensitive: true
}
},
{
//hash images for caching, skip favicons
test: /\.(png|svg|jpg|gif|ico|pdf|woff2?|ttf|eot|js)$/,
exclude: /(node_modules|favicons)/,
loader: 'file-loader',
options: {
name: '[path][name]-[hash].[ext]',
}
},
{
//typescript
test: /\.(ts|d\.ts)$/,
loader: 'awesome-typescript-loader'
}
],
},
resolve: {
extensions: [ '.ts', '.tsx', ".js", ".json"]
},
devServer: {
host: '0.0.0.0',
contentBase: './demo',
historyApiFallback: true,
port: 9003,
compress: false,
inline: true,
hot: true,
stats: {
assets: true,
children: false,
chunks: false,
hash: false,
modules: false,
publicPath: false,
timings: true,
version: false,
warnings: true,
colors: {
green: '\u001b[32m',
}
},
},
plugins: [new HtmlWebpackPlugin({
title: "Typr.js -> Typr.ts conversion",
template: path.join(sourcePath, '/index.html')
})]
};