1


我正在尝试为我的 ionic 5 应用程序设置自定义 webpack 配置,在 ionic 5 文档中没有任何内容,所以我遵循了 ionic 3 doc。

在我的 package.json 中,我添加了这样的脚本和配置:

 "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build:apk": "ionic cordova build android",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "private": true,
  "config": {
    "ionic_webpack": "custom.webpack.config.js"
  },

当我运行“离子服务”时,我收到了这个错误:

src\app\main.ts was not found. The "main.dev.ts" and "main.prod.ts"
[npm]             files have been deprecated. Please create a new file "main.ts" containing the content of "main.dev.ts", and

我想知道离子 5 中是否有不同的方式,或者其他有帮助的方法

4

1 回答 1

0

晚了,但如果您仍然需要它,通过查看文档,您可以将自定义脚本挂接到 ionic serve

https://ionicframework.com/docs/cli/configuration#hooks

于 2021-04-06T20:12:18.673 回答