vue报错: Cannot assign to read only property 'exports' of object '#<Object>'
来源:互联网 发布:壳牌经销商网络大学 编辑:程序博客网 时间:2024/06/05 17:26
刚刚运行一下以前的一个Vue+webpack的demo,运行之后没有出现想象中的效果,并且报错
Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘
点开错误的文件,标注错误的地方是这样的一段代码:
import {normalTime} from ‘./timeFormat‘;
module.exports={
normalTime
};
就是module.exports;
百度查不到,google一查果然有。
原因是:The code above is ok. You can mix require
and export
. You can‘t mix import
and module.exports
.
翻译过来就是说,代码没毛病,在webpack打包的时候,可以在js文件中混用require和export。但是不能混用import 以及module.exports。
因为webpack 2中不允许混用import和module.exports,
解决办法就是统一改成ES6的方式编写即可.
import {normalTime} from ‘./timeFormat‘;export default normalTime;
最后运行成功。
阅读全文
0 0
- vue报错: Cannot assign to read only property 'exports' of object '#<Object>'
- vue引入插件Cannot assign to read only property 'exports' of object '#<Object>'
- Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
- Cannot assign to read only property 'exports' of object '#<Object>' 解决方案
- Cannot assign to read only property 'exports' of object '#<Object>' (mix require and export) #4039
- vue报错 vue Cannot read property ‘ob’ of undefined
- OPCAutomation_TLB.pas(1240): Cannot assign to a read-only property 问题解决
- Vue2.0 之 vue Cannot read property '__ob__' of undefined 异常(back报错)
- more safe way to assign a property value of an object to a variable
- Cannot serialize Object to ViewState only Session
- sencha touch报错 Cannot read property 'apply' of undefined
- 浏览器报错:Cannot read property 'style' of null
- 解决jquery报错cannot read property 'length' of undefined
- 日常-关于“Cannot read property 'length' of null”报错
- 解决dataTable 报错:cannot read property "style" of undefined
- Angularjs报错:TypeError: Cannot read property 'slice' of undefined
- jQuery EasyUI 报错:Cannot read property length of XXX
- react native 报错:cannot read property 'length' of undefined
- phpcms v9站点管理自定义变量 增加客服qq备案号等字段
- 错误ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- ASP.NET MVC 4 插件化架构简单实现-思路篇
- Windows系统“运行”也有快捷方式
- spark<Dataframe 直接写入hive表>
- vue报错: Cannot assign to read only property 'exports' of object '#<Object>'
- Unknown failure (at android.os.Binder.execTransact(Binder.java:565))Error while Installing APKs
- 索引的学习及使用
- [Android][第一行代码][第 6 章 数据存储]
- java实体类重写toString方法,得到想要字符串
- 2 判断手机号码
- Ora-29913: Error In Executing Odciexttableopen Callout (文档 ID 353642.1)
- Redis简易教程
- windows环境下unistd.h缺失解决方法