Conversation
Contributor
AviVahl
commented
Dec 8, 2024
- all packages are now "type": "module"
- replaced commonjs calls with their esm counterparts
- ensure all dynamic imports now use pathToFileURL to properly work on win32
- removed now-unneeded helper that bypassed typescript transpilation to get to the "real" import()
- changed default output format to esm
AviVahl
commented
Dec 9, 2024
| }; | ||
| const handleInitializeError = (e: AnyMessage) => { | ||
| rej(new Error(`failed initializing environment ${envName} with error message: ${JSON.stringify(e.data)}`)); | ||
| rej(new Error(`failed initializing environment ${envName}`, { cause: e.data })); |
Contributor
Author
There was a problem hiding this comment.
this one actually prints the error now :)
ab8afb2 to
512e78b
Compare
- all packages are now "type": "module" - replaced commonjs calls with their esm counterparts - ensure all dynamic imports now use pathToFileURL to properly work on win32 - removed now-unneeded helper that bypassed typescript transpilation to get to the "real" import() - changed default output format to esm
512e78b to
c3d4a4c
Compare
AviVahl
commented
Dec 11, 2024
| if one want to change this to esm, make sure that some bundle splitting is happening. | ||
| */ | ||
| format: 'iife', | ||
| format: 'esm', |
Contributor
Author
There was a problem hiding this comment.
@barak007 let's discuss this. I saw no other way to get native esm working downstream.
AviVahl
commented
Dec 11, 2024
|
|
||
| const jsOutExtension = '.js' as '.js' | '.mjs'; | ||
| const nodeFormat = jsOutExtension === '.mjs' ? 'esm' : 'cjs'; | ||
| const nodeFormat = 'esm' as 'esm' | 'cjs'; |
Contributor
Author
There was a problem hiding this comment.
^ this is interesting. basically forcing esm
AviVahl
commented
Dec 11, 2024
| try { | ||
| const text = outputFiles[0]!.text; | ||
| const module = { exports: { default: undefined as any } }; | ||
| const require = createRequire(import.meta.url); |
Contributor
Author
There was a problem hiding this comment.
not sure about this. we're in esm context now. manual evaluation with require?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.