-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
45 lines (44 loc) · 1.06 KB
/
Copy pathwebpack.config.js
File metadata and controls
45 lines (44 loc) · 1.06 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
module.exports = (env = {}, argv) => ({
entry: {
app: './example.tsx'
},
output: {
filename: '[name].[contenthash].js',
// This defaults using process.cwd, which is usually identical but not as stable as __dirname
path: path.resolve(__dirname, 'dist'),
clean: true
},
resolve: {
// Required to import .ts and .tsx files
extensions: ['.ts', '.tsx', '.js', '.json']
},
devServer: {
historyApiFallback: true
},
watchOptions: {
ignored: ['**/node_modules']
},
devtool: 'eval-cheap-module-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
exclude: [/node_modules/],
use: [
{
loader: 'ts-loader'
}
]
}
]
},
plugins: [
new HtmlWebpackPlugin(),
// This runs the TypeScript typechecking in a separate process from the bundling, greatly increasing build speed
new ForkTsCheckerWebpackPlugin()
]
});