Skip to content

Commit c0ed071

Browse files
committed
chore: fix issue caused during applying old comments
1 parent 34f0373 commit c0ed071

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

src/generators/web/utils/bundle.mjs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default async function bundleCode(codeMap, { server = false } = {}) {
2626
const clientExperimentalConfig = {
2727
// Generate an import map for cache-busted module resolution in browsers
2828
// https://rolldown.rs/options/experimental#chunkimportmap
29-
chunkImportMap: !server && {
29+
chunkImportMap: {
3030
baseUrl: './',
3131
fileName: 'importmap.json',
3232
},
@@ -43,8 +43,8 @@ export default async function bundleCode(codeMap, { server = false } = {}) {
4343
output: {
4444
// Output module format:
4545
// - "cjs" for CommonJS (used in Node.js environments)
46-
// - "iife" for browser environments (self-contained script tag)
47-
format: server ? 'cjs' : 'iife',
46+
// - "esm" for browser environments (Using Chunk Code-Splitting)
47+
format: server ? 'cjs' : 'esm',
4848

4949
// Minify output only for browser builds to optimize file size.
5050
// Server builds are usually not minified to preserve stack traces and debuggability.
@@ -66,25 +66,27 @@ export default async function bundleCode(codeMap, { server = false } = {}) {
6666
? ['preact', 'preact-render-to-string', '@node-core/ui-components']
6767
: [],
6868

69-
// Inject global compile-time constants that will be replaced in code.
70-
// These are useful for tree-shaking and conditional branching.
71-
// Be sure to update type declarations (`types.d.ts`) if these change.
72-
define: {
73-
// Static data injected directly into the bundle (as a literal or serialized JSON).
74-
__STATIC_DATA__: staticData,
75-
76-
// Boolean flags used for conditional logic in source code:
77-
// Example: `if (SERVER) {...}` or `if (CLIENT) {...}`
78-
// These flags help split logic for server/client environments.
79-
// Unused branches will be removed via tree-shaking.
80-
SERVER: String(server),
81-
CLIENT: String(!server),
82-
},
69+
transform: {
70+
// Inject global compile-time constants that will be replaced in code.
71+
// These are useful for tree-shaking and conditional branching.
72+
// Be sure to update type declarations (`types.d.ts`) if these change.
73+
define: {
74+
// Static data injected directly into the bundle (as a literal or serialized JSON).
75+
__STATIC_DATA__: staticData,
76+
77+
// Boolean flags used for conditional logic in source code:
78+
// Example: `if (SERVER) {...}` or `if (CLIENT) {...}`
79+
// These flags help split logic for server/client environments.
80+
// Unused branches will be removed via tree-shaking.
81+
SERVER: String(server),
82+
CLIENT: String(!server),
83+
},
8384

84-
// JSX transformation configuration.
85-
// `'react-jsx'` enables the automatic JSX runtime, which doesn't require `import React`.
86-
// Since we're using Preact via aliasing, this setting works well with `preact/compat`.
87-
jsx: 'react-jsx',
85+
// JSX transformation configuration.
86+
// `'react-jsx'` enables the automatic JSX runtime, which doesn't require `import React`.
87+
// Since we're using Preact via aliasing, this setting works well with `preact/compat`.
88+
jsx: 'react-jsx',
89+
},
8890

8991
// Module resolution aliases.
9092
// This tells the bundler to use `preact/compat` wherever `react` or `react-dom` is imported.

0 commit comments

Comments
 (0)