Skip to content

Commit

Permalink
fix: pass filename to parseAsync. (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney committed Aug 11, 2023
2 parents d80177c + 7cbe58a commit 673ab2e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-dual-package",
"version": "1.1.0",
"version": "1.1.1",
"description": "CLI for building a dual ESM and CJS package with Babel.",
"type": "module",
"main": "dist",
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const babelDualPackage = async (moduleArgs) => {
plugins,
presets,
babelrc: unused,
filename: overwritten,
...options
} = babelProjectConfig.options
const outDir = resolve(relative(cwd(), args.values['out-dir']))
Expand Down
2 changes: 2 additions & 0 deletions src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const transform = async (filename, opts) => {
const baseOpts = { ...rest, comments, configFile: false }
const specifierOpts = { esm, cjs, outFileExtension, source }
const ast = await parseAsync(source, {
filename,
parserOpts: {
sourceType: 'module',
allowAwaitOutsideFunction: true,
Expand Down Expand Up @@ -70,6 +71,7 @@ const updateDtsSpecifiers = async (filename, outFileExtension) => {
const esm = new MagicString(source)
const cjs = new MagicString(source)
const ast = await parseAsync(source, {
filename,
parserOpts: {
sourceType: 'module',
plugins: [['typescript', { dts: true }]]
Expand Down

0 comments on commit 673ab2e

Please sign in to comment.