如何使用地块2.9.3进行建造

问题描述 投票:0回答:1

我正在使用

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)

有人通过包裹构建解决了这个问题吗?

应用程序似乎在 azure DevOps 中构建得很好。

reactjs azure parcel yarn-v2
1个回答
0
投票

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

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

我的package.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'

输出:-

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.