Skip to content

Commit

Permalink
fix(esm): replace suffix for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MickVanDuijn committed May 12, 2023
1 parent a18dd61 commit 0b6bd06
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
const project = path.join(__dirname, '../tsconfig.json')
const dev = fs.existsSync(project) && process.env.DEBUG != 'false'

if (dev && !process.env.NODE_OPTIONS?.includes('--loader ts-node/esm')) {
if (!process.env.NODE_OPTIONS?.includes('--loader ts-node/esm')) {
await new Promise((resolve, reject) => {
const subprocess = spawn(process.argv[0], [...process.argv.slice(1)], {
cwd: process.cwd(),
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
"registry": "https://registry.npmjs.org"
},
"node-standards": {
"extends": "yargs-cli"
"extends": "yargs-cli",
"ignorePatterns": [
"bin/run.js"
]
}
}
Binary file added skyleague-therefore-sfn-1.0.0.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions src/commands/compile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function handler(argv: ReturnType<typeof builder>['argv']): Promise
// If the path is not an absolute path, attempt to resolve it relative to the working directory
file = path.join(process.cwd(), file)
}
file = file.replace(/\.ts$/, '.js')

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { [input.export]: definition } = await import(file)
Expand Down

0 comments on commit 0b6bd06

Please sign in to comment.