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

Not able to import cjs files anymore #5878

Closed
adrai opened this issue May 26, 2020 · 6 comments · Fixed by #6005
Closed

Not able to import cjs files anymore #5878

adrai opened this issue May 26, 2020 · 6 comments · Fixed by #6005
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@adrai
Copy link

adrai commented May 26, 2020

Modules like i18next-fs-backend or i18next-http-backend are written to work for Deno, Node.js and browser environments...

And this works until Deno > v1.0.0...

But now stuff like this is not working anymore: i18next/i18next-fs-backend#5

https://github.com/i18next/i18next-fs-backend/blob/master/lib/readFile.js#L4
import * as fsMod from './fs.cjs'

Any advice?

@bartlomieju bartlomieju self-assigned this May 26, 2020
@bartlomieju bartlomieju added bug Something isn't working correctly cli related to cli/ dir labels May 26, 2020
@bartlomieju
Copy link
Member

Broken in #5029, should be an easy fix

@armujahid
Copy link
Contributor

Can I claim this issue? I will ask if I need any help.

@bartlomieju
Copy link
Member

@armujahid thanks, but this issue is currently blocked by another ongoing refactor in: #5817

@bartlomieju
Copy link
Member

@kitsonk do you think we could just map .cjs extension to JavaScript media type?

@adrai
Copy link
Author

adrai commented May 29, 2020

@kitsonk do you think we could just map .cjs extension to JavaScript media type?

sounds good

@kitsonk
Copy link
Contributor

kitsonk commented May 29, 2020

@bartlomieju it appears in IANA as:

  "application/node": {
    source: "iana",
    extensions: ["cjs"],
  },

So it seems like we could treat it as JavaScript its own thing. Also feels like we should handle the media type "application/node" as well.

Also this where there is .es and .ecma and application/ecmascript:

  "application/ecmascript": {
    source: "iana",
    compressible: true,
    extensions: ["ecma", "es"],
  },

And .mjs which I think we already have:

  "application/javascript": {
    source: "iana",
    charset: "UTF-8",
    compressible: true,
    extensions: ["js", "mjs"],
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants