This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.ts
75 lines (64 loc) · 1.82 KB
/
webpack.config.ts
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
import * as HtmlPlugin from 'html-webpack-plugin';
import * as _ from 'lodash';
import * as webpack from 'webpack';
// https://webpack.js.org/configuration/entry-context/#entry
export const entry = {
test: './test/browser/app.tsx',
};
// https://webpack.js.org/configuration/output/
export const output = {
path: './build',
// Hot reloading doesn't support [chunkhash].
filename: 'scripts/[name].js',
sourceMapFilename: '[file].map',
publicPath: '/',
crossOriginLoading: 'anonymous',
};
// https://webpack.js.org/configuration/module/
export const module = {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
// https://github.com/TypeStrong/ts-loader#options
options: {
silent: true,
compilerOptions: {
// https://github.com/TypeStrong/ts-loader/issues/442
strictNullChecks: false,
},
},
},
],
};
// https://webpack.js.org/configuration/resolve/
export const resolve = {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
};
// https://webpack.js.org/configuration/plugins/
export const plugins = _.compact([
// https://webpack.js.org/plugins/loader-options-plugin/
new (webpack as any).LoaderOptionsPlugin({
minimize: false,
}),
// https://webpack.js.org/guides/hmr-react/
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin#configuration
new HtmlPlugin({
template: './test/browser/index.ejs.html',
inject: false,
minify: {
collapseWhitespace: true,
},
}),
]);
// https://webpack.js.org/configuration/dev-server/
export const devServer = {
hot: true,
historyApiFallback: true,
publicPath: '/',
contentBase: './build',
};
// https://webpack.js.org/configuration/devtool/
export const devtool = 'inline-source-map';