[英]Typescript CRA with MSW: failed to parse source map
I have created a Create React App application with typescript template build in, then i installed MSW with npm and created files based on MSW install guide.我已经创建了一个使用 typescript 模板构建的 Create React App 应用程序,然后我使用 npm 安装了 MSW,并根据 MSW 安装指南创建了文件。 It's working perfectly for jest, but for browser when im using start script i got a bunch of warnings that are saying:
它非常适合开玩笑,但是对于浏览器,当我使用启动脚本时,我收到了一堆警告:
WARNING in ./node_modules/@mswjs/interceptors/lib/utils/uuid.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '<ROOT_DIR>\node_modules\@mswjs\interceptors\src\utils\uuid.ts' file: Error: ENOENT: no such file or directory, open '<ROOT_DIR>\node_modules\@mswjs\interceptors\src\utils\uuid.ts'
@ ./node_modules/@mswjs/interceptors/lib/interceptors/fetch/index.js 167:13-40
@ ./node_modules/msw/lib/esm/index.js 12:0-76 1568:14-28
@ ./src/mocks/browser.ts 3:0-34 6:22-33
@ ./src/index.tsx 8:0-41 10:0-12
and simmilar...和类似的...
I couldn't find any answers so Im asking you for help.我找不到任何答案,所以我向您寻求帮助。
Are you using react-scripts 5
?你在使用
react-scripts 5
吗? Webpack 5
used in that version of react-scripts
is clashing with msw
somehow.该版本的
react-scripts
中使用的Webpack 5
在某种程度上与msw
发生冲突。
You have a couple of options for now:你现在有几个选择:
.env
file in the root of your project containing GENERATE_SOURCEMAP=false
so that you can keep react-scripts 5
;GENERATE_SOURCEMAP=false
的.env
文件来禁用源映射,以便您可以保留react-scripts 5
;react-scripts
to v4
.react-scripts
降级到v4
。 More on the github issue posted by kettanaito有关 kettanaito 发布的github问题的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.