简体   繁体   English

创建 React App(npm run build) 生成包含不需要的 package.json 内容的 chunk.js 文件

[英]Create React App(npm run build) generates chunk.js file with unwanted content of package.json

I have a security issue with that because my *.chunk.js file contains content of package.json file + expected js code of course.我有一个安全问题,因为我的*.chunk.js文件当然包含package.json文件的内容 + 预期的js代码。 How i can get rid of that package.json content?我怎样才能摆脱那个package.json内容?

I'm running default set of CRA2 with我正在运行默认的 CRA2 集

"build-js": "react-scripts build",
"build": "npm-run-all build-js"

As discussed on the comments the issue was import of package.json on the App.js file.正如评论中所讨论的,问题是在 App.js 文件中导入 package.json。

So while building it has added the package.json file data on the chunk.js所以在构建它的时候已经在 chunk.js 上添加了 package.json 文件数据

Removing the import of package.json solved the issue.删除 package.json 的导入解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在共享服务器上托管 create-react-app 构建,获取与 chunk.js 文件相关的 404 错误 - Cannot host create-react-app build on shared server, getting 404 errors related to chunk.js file 如何运行写在外部js文件中的npm脚本(package.json)? - How to run npm script (package.json) written in an external js file? Heroku - 部署 React/Express 应用程序并在请求 chunk.js 文件时在控制台中获取“无法加载资源” - Heroku - Deploying React/Express app and getting 'Failed to load resource' in the console when requesting the chunk.js files 部署后反应白屏,错误404 chunk.js - React white screen after deploy, error 404 chunk.js `npm build` 不运行 package.json 中名为“build”的脚本 - `npm build` doesn't run the script named “build” in package.json 在Windows上,package.json中的React Create App Proxy Agent在Windows上运行缓慢 - React create app proxy agent in package.json is slow on Windows npm从package-lock.json文件中创建一个package.json文件? - npm to create a package.json file out of the package-lock.json file? 当尝试将 hompage 添加到 package.json 并运行 npm run build 时,它显示 / - When trying to add hompage to package.json and run npm run build, it shows / React 脚本问题:循环加载 chunk.js - React scripts issue: loop loading chunk.js 延迟加载不会在Angular中创建chunk.js. - Lazy loading doesn't create chunk.js in Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM