Skip to content

Commit a9757d4

Browse files
vsilentCopilot
andcommitted
web: add webpack config with TS entrypoint for dashboard build
Fix CI frontend build fallback to default ./src entry by defining explicit entry ./src/index.tsx and html template. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bc6967c commit a9757d4

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

web/webpack.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const path = require('path');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
4+
5+
module.exports = {
6+
entry: './src/index.tsx',
7+
output: {
8+
path: path.resolve(__dirname, 'dist'),
9+
filename: 'bundle.[contenthash].js',
10+
publicPath: '/',
11+
},
12+
resolve: {
13+
extensions: ['.tsx', '.ts', '.js'],
14+
},
15+
module: {
16+
rules: [
17+
{
18+
test: /\.tsx?$/,
19+
use: 'ts-loader',
20+
exclude: /node_modules/,
21+
},
22+
{
23+
test: /\.css$/,
24+
type: 'asset/source',
25+
},
26+
],
27+
},
28+
plugins: [
29+
new CleanWebpackPlugin(),
30+
new HtmlWebpackPlugin({
31+
templateContent:
32+
'<!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Stackdog</title></head><body><div id="root"></div></body></html>',
33+
}),
34+
],
35+
devServer: {
36+
static: path.resolve(__dirname, 'dist'),
37+
historyApiFallback: true,
38+
port: 3000,
39+
},
40+
};

0 commit comments

Comments
 (0)