-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathwebpack.dev.config.ts
More file actions
51 lines (48 loc) · 1.23 KB
/
webpack.dev.config.ts
File metadata and controls
51 lines (48 loc) · 1.23 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
46
47
48
49
50
51
import type { Configuration as WebpackConfiguration } from 'webpack';
import type { Configuration as DevServerConfiguration } from 'webpack-dev-server';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'node:path';
/** https://github.com/webpack/webpack-dev-server?tab=readme-ov-file#with-typescript */
type WebpackDevConfig = WebpackConfiguration & {
devServer?: DevServerConfiguration;
};
const config: WebpackDevConfig = {
mode: 'development',
entry: './src/extension/react/index.tsx',
devtool: 'inline-source-map',
devServer: {
static: {
directory: path.resolve(__dirname, 'out'),
},
hot: true,
port: 3000,
open: true,
},
plugins: [
new HtmlWebpackPlugin({
template: './src/extension/index.html',
}),
],
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true, // faster builds for development
},
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
};
export default config;