You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the vue.config.js must be named exactly that, as far as I can see.
I'm using the "type": "moduel" key in package.json, as I'm using the --experimental-modules feature of Nodejs. However, as vue.config.js is not an ES module, an error is thrown and nothing works.
The suggested solution is to rename the file vue.config.cjs, then node accepts the file is in CJS format and it's happy. This change has been implemented in other tools, and, although technically still experimental, it's not likely to be for long. It's already been out from under a flag once, but had to go back because of a lack of ES Lint support (that's been resolved).
It would be helpful, and presumably wouldn't have an impact elsewhere to accept a file called vue.config.cjs, which is functionally and formatted identically (simply accept a second file name with a different extension).
Additionally, presumably this will have to be done eventually, unless Vue intends never to support ES modules, which wouldn't be helpful.
I'm happy to write up a PR, if someone can point me in the direction of where to look...
What does the proposed API look like?
The config file can be called either vue.config.js or vue.config.cjs. They would be identical, other than the extension.
The text was updated successfully, but these errors were encountered:
But I believe using await import(configPath) will be a better solution, which supports both commonjs and module;
however this will make the whole process asynchronous, maybe this will be the Future after something like #4954 is somehow resolved.
What problem does this feature solve?
Currently the
vue.config.js
must be named exactly that, as far as I can see.I'm using the
"type": "moduel"
key inpackage.json
, as I'm using the--experimental-modules
feature of Nodejs. However, as vue.config.js is not an ES module, an error is thrown and nothing works.The suggested solution is to rename the file
vue.config.cjs
, then node accepts the file is in CJS format and it's happy. This change has been implemented in other tools, and, although technically still experimental, it's not likely to be for long. It's already been out from under a flag once, but had to go back because of a lack of ES Lint support (that's been resolved).It would be helpful, and presumably wouldn't have an impact elsewhere to accept a file called
vue.config.cjs
, which is functionally and formatted identically (simply accept a second file name with a different extension).Additionally, presumably this will have to be done eventually, unless Vue intends never to support ES modules, which wouldn't be helpful.
I'm happy to write up a PR, if someone can point me in the direction of where to look...
What does the proposed API look like?
The config file can be called either
vue.config.js
orvue.config.cjs
. They would be identical, other than the extension.The text was updated successfully, but these errors were encountered: