Skip to content

Commit 49fe13f

Browse files
committed
fix: revert import.meta.dirname to __dirname for CJS output
PR1 emits CJS output (no "type": "module" yet), so import.meta is not available. Revert to __dirname in browserScript.ts and createServer.ts. Remove __esModule export from RollupPluginHTMLOptions. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e73f205 commit 49fe13f

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

packages/browser-logs/src/browserScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import path from 'path';
44
const REGEXP_SOURCE_MAP = /\/\/# sourceMappingURL=.*/;
55

66
const serializeScript = fs
7-
.readFileSync(path.resolve(import.meta.dirname, 'serialize.js'), 'utf-8')
7+
.readFileSync(path.resolve(__dirname, 'serialize.js'), 'utf-8')
88
.replace(REGEXP_SOURCE_MAP, '');
99
const logUncaughtErrorsScript = fs
10-
.readFileSync(path.resolve(import.meta.dirname, 'logUncaughtErrors.js'), 'utf-8')
10+
.readFileSync(path.resolve(__dirname, 'logUncaughtErrors.js'), 'utf-8')
1111
.replace(REGEXP_SOURCE_MAP, '');
1212

1313
/**

packages/dev-server-core/src/server/createServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function createServer(
6868

6969
let server: Server;
7070
if (cfg.http2) {
71-
const dir = path.join(import.meta.dirname, '..');
71+
const dir = path.join(__dirname, '..');
7272
const options = {
7373
key: fs.readFileSync(
7474
cfg.sslKey

packages/rollup-plugin-html/src/RollupPluginHTMLOptions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import type { OutputChunk, OutputOptions, OutputBundle } from 'rollup';
22
import type { Attribute } from 'parse5';
33

4-
// Ensure this file is evaluated as an ES module
5-
export const __esModule = true;
64

75
export interface InputHTMLOptions {
86
/** The html source code. If set, overwrites path. */

0 commit comments

Comments
 (0)