已解决Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object ‘#<Object>‘
解决 to of Cannot object Read Only Property
2023-09-27 14:27:32 时间
已解决Uncaught TypeError: Cannot assign to read only property ‘exports’ of object ‘#’
报错问题
之前在工作中遇到过这个坑,记录一下问题以及解决方法,不一定针对所有情况都能用,但是可以供大家参考。
问题描述如下:
Uncaught TypeError: Cannot assign to read only property ‘exports’ of object ‘#’
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;
最后运行成功。
福利
每周会送6本技术书籍包邮到家
由于博主时间精力有限,每天私信人数太多,没办法每个粉丝都及时回复
大家可以进社区裙或者添加博主微信
点击下方链接即可
http://t.csdn.cn/6kInJ
相关文章
- 将平板电脑用于工作合适吗?安全问题怎么解决?
- 解决 redis Increased maximum number of open files to 10032 (it was originally set to 256).
- 问题解决:psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
- 解决android加载图片时内存溢出问题
- 调查显示88%的用户认为存储是企业需要解决的首要问题
- 如何解决Pulling without specifying how to reconcile divergent branches
- unable to access android sdk add-on list的解决
- JMS之——ActiveMQ时抛出的错误Could not connect to broker URL-使用线程池解决高并发连接
- 教新手一步步解决:Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to和更新gradle问题
- Redis "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk"问题的解决
- 解决单链表中的环问题
- 开机提示0xc0000428无法验证此文件的数字签名的解决方法
- maven打包报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.6:test,总结和解决方法汇总
- Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999
- 全网详细学习nginx安装、配置、操作等教程,比如阿里云或centos配置nginx,以及解决不出现 Welcome to niginx页面的问题
- 成功解决:Failed to resolve directive: mode
- 404:源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示的问题解决思路
- 已解决ValueError: not enough values to unpack (expected 2, got 1)
- 已解决TypeError: only size-1 arrays can be converted to Python scalars
- 已解决TypeError: only size-1 arrays can be converted to Python scalars
- 统一认证需要解决的问题
- Android中使用Thread造成内存泄露的分析和解决
- git学习------>"Agent admitted failure to sign using the key." 问题解决方法