-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
transpileDependencies make commonjs modules conflict with webpack module model #1568
Comments
You can also use transpileDependencies. |
@Akryum did you read the repo? without |
If you had tried the repo, you would see the page is all blank, and console would report error. what is |
I'm not sure and can't find a source right now, but I think I remember that this is a limitation with babel and/or webpack when using es6 modules - when importing a "native" commonjs module, you have to use Not sure though, will look further into it. |
the problem is I if I |
Ok, ran the production and can verify the behaviour. Not sure why that happens / how to handle it right now. Sidenote: there are actually two things to consider: 1. When not transpiling to commonjs, you can't use
|
actually, we still can the problem is babel seems not allowing to mix commonjs with es6 module. |
So
|
um, so, it's resolved? |
It's closed because the original issue is invalid (usage that is not supported), and it didn't clearly explain what you are actually trying to achieve. |
I came across something similar in a topic on forum.vuejs.org and took another look. I think I found the underlying issue with the help of this issue in the webpack repo: The problem
So we end up with the error:
Possible Workarounds
|
Yeah, a warning block under Also note that:
|
@LinusBorg the |
Actually, you don't need |
And I finally figure out about this issue. Sample code: const cjsMoudleA = require('cjsModuleA')
export default cjsModuleB add ref: https://github.com/webpack/webpack/blob/master/buildin/harmony-module.js |
using transpileDependencies: [
'need_transpile_module'
],
I tried to write complex regexp to solve it. recently I found Are these related to this issue? @LinusBorg I think it is necessary to remind people who use |
module.exports = {
presets: [
['@vue/app']
],
sourceType: 'unambiguous' // heuristic for every module
} @yyx990803 @LinusBorg in my project, it's useful. more |
Version
3.0.0-rc.1
Reproduction link
https://gitlab.com/MiausF2E/f2e-todos-cli-demo
Steps to reproduce
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = true
inbabel.config.js
yarn serve
and take a look in browser consoleWhat is expected?
no error.
What is actually happening?
es6 import conflict with commonjs declaration
I had discussed in #1248, but it seems no response if I don't file an issue.
The text was updated successfully, but these errors were encountered: