-
Notifications
You must be signed in to change notification settings - Fork 182
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
Uncaught Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax #109
Comments
the lastest version using esm export system , which is conflig with some code in src. import VueAxios from "vue-axios" Let try commonjs build instead. Import VueAxios from "vue-axios/dist/vue-axios.common.min |
Thanks for the suggestion, but still got the same error even changed the code order to Vue.use(VueAxios,axios)
|
@hotrungnhan Not sure what is wrong with the original import method. |
It cause by webpack config of native script because the implement contain both "module.exports" and "export default". |
@hotrungnhan |
@hotrungnhan Should we set the default entry to |
This in index.js cause the error for esm. if (typeof exports == "object") {
module.exports = plugin;
And
Export default plugin
} Just remove export type ,check these all solve. Es6 import syntax is more fomal than the other, so we dont need to keep other. |
@hotrungnhan So what is your suggestion? |
Hi @shilik, could you provide your webpeck config and import way? I can't reproduce the error with vue-cli project. And your fainal solution is to use |
Hi @Alanscut module.exports = (env) => {
});
}; And you are right, I used |
thanks your reply! It seems to relate with the export way of vue-axios, referred to babel/babel#12731 , adding // babel.config.js
module.exports = {
presets: [
[
"@babel/preset-env",
{
useBuiltIns: "usage",
corejs: "3.8.3"
}
]
],
sourceType: "unambiguous"
} |
Hi, @Alanscut Thanks for the advisement. I have tried |
After upgrading to the latest version of vue-axios, I got the following error message.
***** Fatal JavaScript exception - application has been terminated. ***** NativeScript encountered a fatal error: Uncaught Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ./node_modules/vue-axios/dist/vue-axios.esm.min.js at set(file: app/webpack:/douyou/webpack/runtime/harmony module decorator:7:0 at ./node_modules/vue-axios/dist/vue-axios.esm.min.js(file: app/webpack:/douyou/node_modules/vue-axios/dist/vue-axios.esm.min.js:1:688 at __webpack_require__(file: app/webpack:/douyou/webpack/bootstrap:19:0 at ./app/main.js(file:///app/bundle.js:28:68) at __webpack_require__(file: app/webpack:/douyou/webpack/bootstrap:19:0 at __webpack_exec__(file:///app/bundle.js:12601:39) at (file:///app/bundle.js:12602:221) at __webpack_require__.X(file: app/webpack:/douyou/webpack/runtime/startup entrypoint:6:0 at (file:///app/bundle.js:12602:47) at (file:///app/bundle.js:12607:3) at require(:1:137)
Any suggestions for the above errors? Thanks.
The text was updated successfully, but these errors were encountered: