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

Parcel is not compiling .mjs without filename #7812

Closed
MylesWardell opened this issue Mar 9, 2022 · 4 comments
Closed

Parcel is not compiling .mjs without filename #7812

MylesWardell opened this issue Mar 9, 2022 · 4 comments

Comments

@MylesWardell
Copy link

🐛 bug report

Parcel is not compiling .mjs files when the file type is not directly declared by the import
image

.babelrc

{
  "plugins": [
    [
      "module-resolver",
      {
        "root": ["./src"],
        "alias": {
          "~": "./src"
        }
      }
    ]
  ]
}

🤔 Expected Behavior

This should compile

😯 Current Behavior

The compiler throws an error not recognising a valid mjs file

🔦 Context

I am trying to integrate with @Trulioo SDK which provides a unique way of installing their custom SDK. In the node modules (the worst place to throw an error) parcel complains that it does not recognise a .mjs file because it does not include the file type (.mjs)

💻 Code Sample

// How trulioo recommend to import their package 
const GlobalGatewayCapture = require('@trulioo/globalgateway-image-capture-sdk')

🌍 Your Environment

Software Version(s)
Parcel 2.2.1
Node 16.13.2
npm 8.1.2
Operating System Windows
@mischnic
Copy link
Member

mischnic commented Mar 9, 2022

mjs is missing in this list:

? ['ts', 'tsx', 'js', 'jsx', 'json']

I guess we should add it given that it's de-facto standardized by Node.

@MylesWardell
Copy link
Author

Is their any short term solution I can use to get my current project up and running? Otherwise what would the ETA on a potential patch be?

I understand this is an open source project with limited available time, just trying to meet my teams requirements 👍

@danieltroger
Copy link
Contributor

@MylesWardell this sounds like a case for yarn patch. With that you can basically have a patch references from your package.json that will automatically be applied for everyone running yarn install. Here I wrote about how to use a patch: DevExpress/testcafe#6624 (comment) and to generate it just do yarn patch <package>.

Dunno if you need yarn berry for it though.

@devongovett
Copy link
Member

This was added in the last release. #8667

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

No branches or pull requests

4 participants