可加载的组件+ SSR+ WebPack 5-重复main.js
我重构由“ Create-React-App”制作的旧应用程序。我想添加可加载的组件库,并且所有内容都可以使用,直到我添加 extractor.getScriptTags()为index.html。
添加提取器导致webpack
头部 in index.html中生成的main.js文件的重复:
<link data-chunk="main" rel="preload" as="script" href="/main.js">
<link data-chunk="main" rel="stylesheet" href="/static/css/main.52fc8570.css">
<script defer="defer" src="/main.js"></script>
<link href="/static/css/main.52fc8570.css" rel="stylesheet">
正文部分通过extractor.getScripttags()注入脚本
<script async data-chunk="main" src="/main.js"></script>
在构建应用程序开始时生成的片段
<script defer="defer" src="/main.js"></script>
<link href="/static/css/main.52fc8570.css" rel="stylesheet">
是否可以通过webpack禁用注入生成的main.js?
I refactor an old application made by 'create-react-app'. I wanted to add the loadable components library and everything worked until I added extractor.getScriptTags() to index.html.
Adding the extractor resulted in the duplicate of the generated main.js file by the webpack
head section in index.html:
<link data-chunk="main" rel="preload" as="script" href="/main.js">
<link data-chunk="main" rel="stylesheet" href="/static/css/main.52fc8570.css">
<script defer="defer" src="/main.js"></script>
<link href="/static/css/main.52fc8570.css" rel="stylesheet">
body section with script injected via extractor.getScriptTags()
<script async data-chunk="main" src="/main.js"></script>
the fragment generated at the beginning of building the application
<script defer="defer" src="/main.js"></script>
<link href="/static/css/main.52fc8570.css" rel="stylesheet">
Is it possible to disable injection of the generated main.js by the webpack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论