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

Can't transpile module which using .mjs extension #6688

Open
padinko opened this issue Nov 12, 2019 · 3 comments · Fixed by #7178
Open

Can't transpile module which using .mjs extension #6688

padinko opened this issue Nov 12, 2019 · 3 comments · Fixed by #7178
Assignees

Comments

@padinko
Copy link

padinko commented Nov 12, 2019

Version

v2.10.2

Reproduction link

https://codesandbox.io/s/nuxt-mjs-transpile-problem-mo9to

Steps to reproduce

If you import package, which is using .mjs extension, and add transpile to this module, imported code is not transpiled

for example:

  1. npm i rope-sequence
  2. import it somewhere import 'rope-sequence'
  3. add transpile this module to nuxt.config.js transpile: [({ isLegacy }) => isLegacy && "rope-sequence"]
  4. open in IE.. there is error in console

What is expected ?

transpiled module - no const/let and arrow functions

What is actually happening?

module has const and arrow functions

Additional comments?

now I can update regex for babel-loader to /\.m?jsx?$/i and everythink works good in IE
reproduction link with workaround https://codesandbox.io/s/nuxt-mjs-transpile-problem-workaround-z1tme
see nuxt.config.js -> build -> extend

@dargmuesli
Copy link
Member

Looks like this will be fixed with the next version of @nuxt/webpack: #9180

@pencilcheck
Copy link

Thanks for the use of transpile, this also solves @trpc/client and @trpc/server not working since they also uses mjs but I don't need to add the workaround which is nice

@rchl
Copy link

rchl commented May 7, 2023

There was also a follow-up PR at #10340 so I would say that this can be closed.

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.

7 participants