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

Cannot import BCD from ES module anymore in 3.3.0 #9966

Closed
saschanaz opened this issue Apr 19, 2021 · 3 comments · Fixed by #10033
Closed

Cannot import BCD from ES module anymore in 3.3.0 #9966

saschanaz opened this issue Apr 19, 2021 · 3 comments · Fixed by #10033
Labels
infra Infrastructure issues (npm, GitHub Actions, releases) of this project

Comments

@saschanaz
Copy link
Contributor

saschanaz commented Apr 19, 2021

node:internal/process/esm_loader:74
    internalBinding('errors').triggerUncaughtException(
                              ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".json" for C:\Users\Kagami\Documents\GitHub\types-web\node_modules\@mdn\browser-compat-data\data.json
    at new NodeError (node:internal/errors:329:5)
    at Loader.defaultGetFormat [as _getFormat] (node:internal/modules/esm/get_format:71:15)
    at Loader.getFormat (node:internal/modules/esm/loader:104:42)
    at Loader.getModuleJob (node:internal/modules/esm/loader:242:31)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:59:21)
    at async Promise.all (index 0)
    at async link (node:internal/modules/esm/module_job:64:9) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

I guess this is because of #7398, and a .js entry point needs to be exposed until we get JSON Modules.

@queengooborg queengooborg added the infra Infrastructure issues (npm, GitHub Actions, releases) of this project label Apr 20, 2021
@ddbeck
Copy link
Collaborator

ddbeck commented Apr 22, 2021

I want to fix this—we shouldn't break previous usage—but can you provide a little more context on the error itself? How can I reproduce this?

@saschanaz
Copy link
Contributor Author

  1. Create a new directory
  2. Initiate a new npm package with the field "type": "module"
  3. Create index.js with the content import bcd from "@mdn/browser-compat-data"
  4. Run node index.js

@ddbeck
Copy link
Collaborator

ddbeck commented Apr 22, 2021

Thank you, @saschanaz! That's really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra Infrastructure issues (npm, GitHub Actions, releases) of this project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants