Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

Vue的报错:Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘

1.运行一下以前的一个Vue+webpack的 vue仿新闻网站  小项目,报错

由于自己vue学习不深入,老是这个报错,找了好久(确切的说是整整一下午^...^)才找到原因 -v-

Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘

2.点开错误的文件,标注错误的地方是这样的一段代码:

import {normalTime} from ‘./timeFormat‘;

module.exports={
  normalTime
};

就是module.exports;

3.同过谷歌查找,和论坛各种搜索:

原因如下: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;

4.再次运行:

ok^_^

Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

时间: 2024-08-07 18:05:31

Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'的相关文章

Vue报错:Uncaught TypeError: Cannot assign to read only property &#39;exports&#39; of object 的解决方法

问题是这样的:如下>> 解决办法: 1“:我的webpack 最高版本,造成 混用import和module.exports :所以降低webpack版本 安装指定版本:npm install [email protected] -g 例如:npm install [email protected] -g 删除 编译目录文件: 2重新生成 然后输入启动命令: 成功解决!效果: 方法二: 注释掉后一个 重新生成,启动项目 OK! Vue报错:Uncaught TypeError: Cannot

Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#&lt;Object&gt;‘的解决方法

因为webpack 2中不允许混用import和module.exports , 解决办法就是统一改成ES6的方式编写即可. import { copyDeep } from '@/libs/tools.js'; export default copyDeep; 原文地址:https://www.cnblogs.com/easonw/p/10595576.html

easyui Datagrid查询报错Uncaught TypeError:Cannot read property &#39;length&#39; of undefined

1.问题描述 easyui中datagrid执行loadData方法出现如下异常:Cannot read property 'length' of undefined 2.一开始怀疑是js或者页面的问题,然后从早上干到下午,网上各种方法用尽了就是不行! 最后发现规律了: 使用mybatis从数据库查询返回的List不报错,但是自己new的ArrayList总是报错! 后来发现原来mybatis返回的不是ArrayList!而是PageList! 3.解决问题 PageList中有个参数Pagin

jQuery mobile报错 Uncaught TypeError: Cannot read property &#39;concat&#39; of undefined

写一个jQuery mobile的demo <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="styl

[Sencha ExtJS] 关于build production后,浏览器运行报错&#39;Uncaught TypeError: c is not a function&#39;

原文:http://blog.csdn.net/lovelyelfpop/article/details/51328783 估计很多人用 ExtJS6 + Sencha Cmd 6 的时候,遇到过一种情况:开发的时候明明正常的,build之后运行就报了下面的错误 Uncaught TypeError: c is not a function 心里一万个草泥马奔腾:What the hell is this?(这TM什么JB玩意?) 其实根本原因是你忘记了requires某个类导致的. 比如你这样

android webView 图片加载不出来 后台报错Uncaught TypeError: Cannot call method &#39;getElementsByTagName&#39; of null

在之前,webView加载图片完全没有问题.直到前端H5开发换新的加载图片的方式,导致图片忽然加载不出来了. 从后台日志看到了webview 打印了报错信息 Cannot call method 'getElementsByTagName' of null 我怀疑是不是由于此处报错终止了图片加载的进程. 分析此处错误出现的原因: 由于调用的H5界面的js其中的写法不规范,webView在加载的时候,调用的doom模型为空,导致了其图片没有加载出来 解决办法: 在客户端webView.getSet

控制台报错 Uncaught TypeError: $(...).tap is not a function

使用zepto报错 Uncaught TypeError: $(...).tap is not a function 我加载了一下插件 <script src="js/zepto.js"></script><script src="js/event.js"></script><script src="js/touch.js"></script><script src=&

jS Ajax 上传文件报错&quot;Uncaught TypeError: Illegal invocation&quot;

jS Ajax 上传文件报错"Uncaught TypeError: Illegal invocation" query-3.1.1.min.js:4 Uncaught TypeError: Illegal invocation 错误原因: jQuery Ajax 上传文件处理方式, 使用ajax向后台发送数据时其中的图片数据的参数类型为file,属于对象,而不是一个字符串值.导致错误的出现 var formData = new FormData(); formData.append(

ueditor禁用编辑的时候报错:Uncaught TypeError: Cannot read property &#39;contentEditable&#39; of undefined

解决方案 报错的代码片段↓ //初始化编辑器 var conEditor = UE.getEditor('id_Test'); //编辑器.禁用 conEditor.setDisabled(); 修复后代码片段↓ //初始化编辑器 var conEditor = UE.getEditor('id_Test'); //对编辑器的操作最好在编辑器ready之后再做 conEditor.ready(function () { //编辑器.禁用 conEditor.setDisabled(); }) u