Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using await import() #3072

Closed
mulfyx opened this issue Aug 21, 2019 · 3 comments · Fixed by #3073
Closed

Error when using await import() #3072

mulfyx opened this issue Aug 21, 2019 · 3 comments · Fixed by #3073

Comments

@mulfyx
Copy link

mulfyx commented Aug 21, 2019

  • Rollup Version: 1.19.4
  • Operating System (or Browser): Ubuntu 18.04.2 LTS on Windows 10 x86_64
  • Node Version: v12.9.0

How Do We Reproduce?

import { join as pathJoin } from 'path';

export default async function createConfig() {
  const rootPkg = await import(pathJoin(__dirname, 'package.json'));

  console.log(rootPkg);
}

Expected Behavior

console.log displays package.json

Actual Behavior

ReferenceError: pathJoin is not defined

@mulfyx mulfyx changed the title Error when await impor() Error when using await import() Aug 21, 2019
@mulfyx
Copy link
Author

mulfyx commented Aug 21, 2019

if write

import { join as pathJoin } from 'path';

export default async function createConfig() {
  const pkgPath = pathJoin(__dirname, 'package.json');

  const rootPkg = await import(pkgPath);

  console.log(rootPkg);
}

it works

@lukastaegert
Copy link
Member

Fix at #3073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants