首页 > 解决方案 > 反应开发构建没有生成非缩小 js 文件

问题描述

我用

npm install dotenv-cli --save-dev

以前的

{
  "name": "gsreact",
  "version": "0.1.0",
  "homepage": ".",
  "private": true,
  "dependencies": {
    "@fullcalendar/core": "4.0.2",
    "@fullcalendar/daygrid": "4.0.1",
    "@fullcalendar/interaction": "4.0.2",
    "@fullcalendar/timegrid": "4.0.1",
    "axios": "^0.21.1",
    "chart.js": "2.7.3",
    "classnames": "^2.2.6",
    "i18next": "^20.4.0",
    "js-cookie": "^2.2.1",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "node-sass": "^4.12.0",
    "primeflex": "2.0.0",
    "primeicons": "4.1.0",
    "primereact": "^6.5.1",
    "prismjs": "^1.15.0",
    "quill": "1.3.7",
    "react": "^17.0.1",
    "react-app-polyfill": "^2.0.0",
    "react-dom": "^17.0.1",
    "react-hook-form": "^7.14.2",
    "react-i18next": "^11.11.4",
    "react-moment": "^1.1.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.0",
    "react-to-print": "^2.13.0",
    "react-transition-group": "^4.4.1",
    "uuid": "^8.3.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build && rmdir /s E:\\bar\\foo-framework\\runtime\\base-component\\webroot\\screen\\webroot\\rclient && move build E:\\bar\\foo-framework\\runtime\\base-component\\webroot\\screen\\webroot\\rclient",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

之后

{
  "name": "gsreact",
  "version": "0.1.0",
  "homepage": ".",
  "private": true,
  "dependencies": {
    "@fullcalendar/core": "4.0.2",
    "@fullcalendar/daygrid": "4.0.1",
    "@fullcalendar/interaction": "4.0.2",
    "@fullcalendar/timegrid": "4.0.1",
    "axios": "^0.21.1",
    "chart.js": "2.7.3",
    "classnames": "^2.2.6",
    "i18next": "^20.4.0",
    "js-cookie": "^2.2.1",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "node-sass": "^4.12.0",
    "primeflex": "2.0.0",
    "primeicons": "4.1.0",
    "primereact": "^6.5.1",
    "prismjs": "^1.15.0",
    "quill": "1.3.7",
    "react": "^17.0.1",
    "react-app-polyfill": "^2.0.0",
    "react-dom": "^17.0.1",
    "react-hook-form": "^7.14.2",
    "react-i18next": "^11.11.4",
    "react-moment": "^1.1.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.0",
    "react-to-print": "^2.13.0",
    "react-transition-group": "^4.4.1",
    "uuid": "^8.3.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build && rmdir /s E:\\bar\\foo-framework\\runtime\\base-component\\webroot\\screen\\webroot\\rclient && move build E:\\bar\\foo-framework\\runtime\\base-component\\webroot\\screen\\webroot\\rclient",
    "build-env": "dotenv -e .env.development react-scripts build && rmdir /s E:\\bar\\foo-framework\\runtime\\base-component\\webroot\\screen\\webroot\\rclient && move build E:\\bar\\foo-framework\\runtime\\base-component\\webroot\\screen\\webroot\\rclient",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "dotenv-cli": "^4.0.0"
  }
}

我的环境:

在此处输入图像描述

我跑

npm run build-env

但我没有开发版本。如何解决?

标签: node.jsreactjswebpackcreate-react-apppackage.json

解决方案


推荐阅读