最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to run React.js app without react-scripts? - Stack Overflow

programmeradmin0浏览0评论

My React.js app was created with this mand:

npx create-react-app my-app

Now how can I convert this script section in package.json to run the app without react-scripts?

  "scripts": {
    "start": "NODE_ENV=development node_modules/react-scripts/bin/react-scripts.js start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

Should it be something like:

node index.js

How do I convert each option in that scripts section? Thanks

My React.js app was created with this mand:

npx create-react-app my-app

Now how can I convert this script section in package.json to run the app without react-scripts?

  "scripts": {
    "start": "NODE_ENV=development node_modules/react-scripts/bin/react-scripts.js start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

Should it be something like:

node index.js

How do I convert each option in that scripts section? Thanks

Share asked Jul 29, 2022 at 21:46 John GlabbJohn Glabb 1,6138 gold badges31 silver badges64 bronze badges 2
  • What is the purpose of this? – Konrad Commented Jul 29, 2022 at 21:47
  • 1 the whole pany applications should be converted.. They do not want to use react-scripts due to some vulnerability issues in react-scripts dependencies – John Glabb Commented Aug 1, 2022 at 1:26
Add a ment  | 

2 Answers 2

Reset to default 4

When you create a React app with npx create-react-app my-app you make your react app dependant of react-scripts.

If you no longer want to use this react-scripts who give you a lot of help you can follow this tutorial from the official documentation to eject yourself.

But you can't remove the dependency from an existing project, maybe you are considering to make a new one, and this tutorial will help you to achieve it !

Good thing to do would be to migrate to Vite or Parcel. Or use a Production-grade react framework like Gatsby or Nest.js. You can lean more from here React without a framework.

发布评论

评论列表(0)

  1. 暂无评论