13.7.0
in vue component file, if i use the commonjs way to export
// error way
module.exports = {
name: 'component-name'
}
// normal write
export default {
}
Because of some historical writing
compile is ok.
find error
21:2-16 "export 'default' (imported as '__vue_script__') was not found in '!!babel-loader!../../../node_modules/vue-loader/lib/selector?type=script&index=0!./component-upload.vue'
It should be module.exports instead of module.export.
@Justineo Sorry, writing error, got change.
See breaking changes in v13.0.0.
old CommonJS-style requires will also need to be updated:
// before
const Foo = require('./Foo.vue')
// after
const Foo = require('./Foo.vue').default
BTW, I think you can upgrade your vue-loader to the 14 or higher version. because from v14.0.0
esModules option has been removed. Built module is now always exposed as an ES module.
@ulivz vue-loader has been updated to v14.1.0, question is still.
so i need to do something for babel in vue-loader config ?
Could you provide your webpack's version? or it would be better to also provide a minimal reproduction repo link.
@ulivz use the vue-cli webpack config, webpack version is 3.6.0
14.0+ no longer supports module.exports. Use export default instead.
@yyx990803 I have a library that requires this logic to pass
typeof module.exports !== 'undefined'
No matter what I try, it is always undefined :(
I am sure it is a Webpack fix instead of Vue, but just in case, any advice?
Is anyway to support module.exports in vue-cli3 created project ?
Because I would like to share some common module with frontend and backend.
Most helpful comment
Is anyway to support module.exports in vue-cli3 created project ?
Because I would like to share some common module with frontend and backend.