-
-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added a transpile-only ESM loader (#1101) * feat: Added transpile-only ESM loader to package.json exports and resolve tests * feat: Added success/failure tests for transpile-only ESM loader * fix: Fix transpile-only ESM loader tests Fixed ESM tests being executed under node 13.0.0 Fixed error message matching criteria * fix: Fix erroneous quotations in transpile-only ESM loader tests * feat: Removed imports on tests for esm-transpile-only tests * feat: Renamed and restructured esm-transpile-only tests
- Loading branch information
Showing
6 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {fileURLToPath} from 'url' | ||
import {createRequire} from 'module' | ||
const require = createRequire(fileURLToPath(import.meta.url)) | ||
|
||
/** @type {import('../dist/esm')} */ | ||
const esm = require('../dist/esm') | ||
export const {resolve, getFormat, transformSource} = esm.registerAndCreateEsmHooks({transpileOnly: true}) |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if (typeof module !== 'undefined') throw new Error('module should not exist in ESM') | ||
|
||
// intentional type errors to check transpile-only ESM loader skips type checking | ||
parseInt(1101, 2) | ||
const x: number = 'hello world' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"allowJs": true, | ||
"jsx": "react" | ||
} | ||
} |