【发布时间】:2021-10-25 05:04:02
【问题描述】:
我将我的 CRA 项目迁移到 Next js,我仍然使用我的 CRA 应用程序,只是安装了 next js 并进行了一些更改。现在我的 CRA 应用程序在 IE 11 中运行良好,我正在使用 socket io 来实现我的聊天功能。但是当我将我的 CRA 迁移到 Next js 时,在 IE 中出现了这个错误。
SCRIPT1002: Syntax error
_app.js (24050,23)
这是我点击错误时显示的内容
/***/ "./node_modules/debug/src/browser.js":
/*!*******************************************!*\
!*** ./node_modules/debug/src/browser.js ***!
\*******************************************/
/***/ (function(module, exports, __webpack_require__) {
/* provided dependency */ var process = __webpack_require__(/*! process */
"./node_modules/process/browser.js");
/* eslint-env browser */
/**
* This is the web browser implementation of `debug()`.
*/
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
exports.destroy = (() => {
let warned = false;
return () => {
if (!warned) {
warned = true;
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
}
};
})();
我做了很多研究,现在我已经坚持了 3 天。我尝试使用 next-transpile-modules 转换“调试”依赖项,但随后它显示另一个错误,在不同的依赖项上,我尝试再次转换该“依赖项”,然后再次转换另一个,直到出现错误循环.似乎套接字 io 客户端正在使用的所有依赖项都没有被转译。我想知道为什么我的 CRA 应用程序在 IE 11 中运行良好,而我的 CRA/Next JS 却不行。我认为该错误是由套接字 io 客户端引起的,导致每次我添加包含套接字 io-client 的页面/组件时,都会发生错误,当我删除它时,错误就消失了。请帮助如何解决这个问题,我需要转换整个 node_modules 还是什么?请帮忙谢谢!
【问题讨论】:
标签: reactjs internet-explorer next.js node-modules create-react-app