-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
48 lines (44 loc) · 1.03 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
import { Configuration } from "webpack";
const webpack = require('webpack')
const path = require('path')
const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const distDir = path.resolve(__dirname, 'sample-dist')
const config: Configuration = {
entry: './sample/index.tsx',
devtool: 'source-map',
output: {
path: distDir,
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.(ts|tsx)?$/,
loader: 'ts-loader',
exclude: [/node_modules/],
options: { configFile: 'sample/tsconfig.build.json' },
}
]
},
resolve: {
extensions: [
'.tsx',
'.ts',
'.js'
],
plugins: [new TsconfigPathsPlugin({ configFile: './sample/tsconfig.build.json' })],
},
plugins: [
new HtmlWebpackPlugin({
template: './sample/index.html',
}),
],
devServer: {
contentBase: distDir,
compress: true,
port: 9000,
historyApiFallback: true,
}
}
module.exports = config;