Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Warning Babel parse has failed: import.meta may appear only with 'sourceType: "module"' (11:69) #1404

Closed
JustinBeckwith opened this issue Nov 17, 2021 · 1 comment

Comments

@JustinBeckwith
Copy link

What version of pkg are you using?

5.4.1

What version of Node.js are you using?

16.13.0

What operating system are you using?

macOS

What CPU architecture are you using?

x86_64

What Node versions, OSs and CPU architectures are you building for?

node16-linux-x64, node16-macos-x64, node16-win-x64

Describe the Bug

I recently converted an npm CLI I ship from CommonJS to ES Modules, dropping support for node 10 in the process. Now when I run pkg, I am getting the following error:

linkinator (main) $ npm run build-binaries

> linkinator@0.0.0 build-binaries
> pkg . --out-path build/binaries

> pkg@5.4.1
> Targets not specified. Assuming:
  node16-linux-x64, node16-macos-x64, node16-win-x64
> Warning Babel parse has failed: import.meta may appear only with 'sourceType: "module"' (11:69)
> Error! Cannot read file, ENOENT
  node:path

I do use import.meta in the code, as I'm targeting node.js 12 and above where this should be available. I've also set "type": "module" in my package.json to signal that this is an esm module.

Expected Behavior

I would expect it to not throw an error :)

To Reproduce

To reproduce this, using the latest version of Node.js 16.x:

git clone https://github.com/JustinBeckwith/linkinator
cd linkinator
npm install
npm run build-binaries
@robertsLando
Copy link
Contributor

robertsLando commented Nov 24, 2021

esm modules are not supported yet, follow updates in other issue

#1291

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

No branches or pull requests

2 participants