azure 如何使用2.9.3包进行构建

vxf3dgd4  于 2023-10-22  发布在  其他
关注(0)|答案(1)|浏览(83)

我正在用yarn (1.22)parcel(2.9.3)包构建一个react web应用程序,并在控制台中得到这个错误:

Uncaught Error: Could not resolve bundle with id bundle-manifest.js:13 runtime-49a0cc4de56a254e.js:1 in the browser (firefox, chrome)

有没有人用parcel build解决了这个问题?
应用程序似乎在Azure DevOps中构建良好。

xdnvmnnf

xdnvmnnf1#

为了解决您的错误,请确保在本地代码中重新安装包,然后将更改推送到Azure DevOps存储库中,如下所示:

npm i [email protected]
npm i parcel
npm audit fix

我的包。json:-

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
    "@babel/plugin-transform-private-property-in-object": "^7.22.11",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "^5.0.1",
    "swiper": "^10.0.4",
    "web-vitals": "^2.1.4",
    "yarn": "^1.22.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

尝试更新npm模块并清理该高速缓存:-

npm install -g npm
npm cache clean --force

我的Devops构建yaml脚本:-

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '18.x'
  displayName: 'Install Node.js'

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'

输出:-

相关问题