-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from n1ru4l/named-export
replace default export with a named export
- Loading branch information
Showing
8 changed files
with
51 additions
and
7 deletions.
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
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
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
import { TypeScriptLoader } from "./loader"; | ||
|
||
export default TypeScriptLoader; | ||
export { TypeScriptLoader } from "./loader"; | ||
export type { TypeScriptCompileError } from "./typescript-compile-error"; |
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 @@ | ||
const mod = require("../dist/cjs/index.js"); | ||
const { TypeScriptLoader } = mod; | ||
TypeScriptLoader(); | ||
|
||
console.info("Loaded with CJS successfully"); |
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 @@ | ||
import mod from "../dist/cjs/index.js"; | ||
const { TypeScriptLoader } = mod; | ||
TypeScriptLoader(); | ||
|
||
console.info("Loaded with ESM successfully"); |
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,26 @@ | ||
const assert = require("node:assert"); | ||
|
||
(async () => { | ||
try { | ||
const esm = await import("../dist/cjs/index.js"); | ||
const cjs = require("../dist/cjs/index.js"); | ||
|
||
assert.strictEqual( | ||
esm.TypeScriptLoader, | ||
cjs.TypeScriptLoader, | ||
"esm.TypeScriptLoader === cjs.TypeScriptLoader" | ||
); | ||
|
||
// try to create loaders | ||
esm.TypeScriptLoader(); | ||
cjs.TypeScriptLoader(); | ||
|
||
console.info("Loaded with both CJS and ESM successfully"); | ||
} catch (error) { | ||
console.error(error); | ||
console.debug(error.stack); | ||
|
||
// Prevent an unhandled rejection, exit gracefully. | ||
process.exit(1); | ||
} | ||
})(); |