Change bundle link for dev server

This commit is contained in:
Nick Playfair 2025-06-11 14:39:20 +01:00
parent 21296a9b0d
commit 59c5f71768
2 changed files with 22 additions and 11 deletions

View File

@ -30,6 +30,6 @@
<pre id="partsHTML"></pre> <pre id="partsHTML"></pre>
</section> </section>
</main> </main>
<script src="dist/bundle.js"></script> <script src="bundle.js"></script>
</body> </body>
</html> </html>

View File

@ -1,28 +1,39 @@
const path = require("path"); const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = { module.exports = {
mode: "development", mode: 'development',
entry: "./src/index.ts", entry: './src/index.ts',
devtool: "inline-source-map", devtool: 'inline-source-map',
devServer: { devServer: {
static: { static: {
directory: path.join(__dirname, "./"), directory: path.join(__dirname, './'),
}, },
}, },
module: { module: {
rules: [ rules: [
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
use: "ts-loader", use: 'ts-loader',
exclude: /node_modules/, exclude: /node_modules/,
}, },
], ],
}, },
resolve: { resolve: {
extensions: [".tsx", ".ts", ".js"], extensions: ['.tsx', '.ts', '.js'],
}, },
output: { output: {
filename: "bundle.js", filename: 'bundle.js',
path: path.resolve(__dirname, "dist"), path: path.resolve(__dirname, 'dist'),
publicPath: "/dist", publicPath: '/dist',
}, },
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: 'html/**/*',
to: '[name][ext]',
},
],
}),
],
}; };