用weex做項目的時候,npm start 之后一直報錯error:Cannot assign to read only property 'exports' of object '#<Object>' ,查了好多資料好像是export和import共用了導致不兼容引起的
試了好多方法都不行,最后找到個辦法,試了一下可以用,特此記錄:
npm install babel-plugin-transform-es2015-modules-commonjs
然后在 babelrc中配置
{ "plugins": ["transform-es2015-modules-commonjs"] }
即可解決