I have a project that I need to use bun to bundle up the typescript of the web page. I don’t know if I should bundle the html pages or the typescript files.
Here is my bun.js settings:
import html from 'bun-plugin-html';
await Bun.build({
entrypoints: ['./public/page1.html', './public/page2.html', './public/page3.html'],
sourcemap: "inline",
outdir: './public',
plugins: [
html()
],
});
The problem with the above is that the html pages are over written. In each page is the script:
<script type="module" src="index.ts">
When I run bun run start
that web page changes that line to point to the javascript file:
<script type="module" src="index.js">
I’d like to keep everything in the same directory. I could rename the public directory to source and then export to public
but then, what I’m trying to do is bundle the typescript files themselves and I could leave the html pages alone if that makes sense.
So could I point to the typescript files in those html pages and then created the bundled javascript files? Does that make sense?
Here is my bun.js settings:
// point to typescript files and leave the html pages out of it
await Bun.build({
entrypoints: ['./public/page1.ts', './public/page2.ts', './public/page3.ts'],
sourcemap: "inline",
outdir: './public',
});
Is that possible?