This unfortunate mistake was very successful when it was developed on Mac computers, but it was an error when using Windows.
Baidu can't find, Google a check sure there is.
The reason: The code above is OK. You can mix and require
export
. You can ' t mix and import
module.exports
.
In other words, when webpack packaging, you can mix require and export in JS files. But you can't mix import and Module.exports.
So check the code, in their own main.js this section of code:
Import selector from '. /packages/selector '; Import alert from '. /packages/alert '; const components=[ selector, alert,]const install=function (vue,option={}) { Components.map (component = { vue.component (component.name, component); }) Vue.prototype. $alert =alert; Vue.prototype. $info =alert.error; Vue.prototype. $error =alert.error;} module.exports={ version: ' 0.0.1 ', Install,}
This code uses the import statement at the very beginning, but finally uses the Module.exports statement. So it's an error.
Correct it:
var selector = require ('.. /packages/selector '); var alert=require ('.. /packages/alert '); const components=[ selector, alert,]const install=function (vue,option={}) { Components.map (component = { vue.component (component.name, component); }) Vue.prototype. $alert =alert; Vue.prototype. $info =alert.error; Vue.prototype. $error =alert.error;} module.exports={ version: ' 0.0.1 ', Install,}
It's done.
So remind me to use require and module.exports as well as import and export default for future pairing.
Don't mix, save the problem.
Webpack Error: Cannot assign to read the property ' exports ' of object ' #<object> '