Skip to content

Commit 543993e

Browse files
authored
Webpack workaround (#22605)
The string of code `new URL('./', import.meta.url)` causes webpack to try and resolve the URL, which causes problems for downstream users who are using that bundler: webpack/webpack#16878 electric-sql/pglite#328 This PR replaces `new URL('./', import.meta.url)` with `new URL('./', Object(import.meta).url)`, which is a workaround for this behavior.
1 parent d593938 commit 543993e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ if (ENVIRONMENT_IS_NODE) {
235235
// EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url,
236236
// since there's no way getting the current absolute path of the module when
237237
// support for that is not available.
238-
scriptDirectory = require('url').fileURLToPath(new URL('./', import.meta.url)); // includes trailing slash
238+
scriptDirectory = nodePath.dirname(require('url').fileURLToPath(import.meta.url)) + '/';
239239
#else
240240
scriptDirectory = __dirname + '/';
241241
#endif

0 commit comments

Comments
 (0)