我需要在Angular cli项目中自定义webpack包构建。为了配置我弹出webpack配置文件。
ng eject
一旦我这样做,我就无法运行webpack build和serve命令,因为我收到以下错误。
An ejected project cannot use the build command anymore
如果弹出后无法使用构建命令,那么弹出后使用webpack的最佳方法是什么。
答案 0 :(得分:4)
运行ng eject
命令时,这是在提示符处显示的输出:
ng eject
==========================================================================================
Ejection was successful.
To run your builds, you now need to do the following commands:
- "npm run build" to build.
- "npm run test" to run unit tests.
- "npm start" to serve the app using webpack-dev-server.
- "npm run e2e" to run protractor.
Running the equivalent CLI commands will result in an error.
==========================================================================================
Some packages were added. Please run "npm install".
你需要知道的一切,就在那里。
查看package.json
内部以查看scripts
部分的更新。还有一些命令没有在上面的输出中显示。
希望这有帮助。
<强>更新强>
如果有人不知道,即使在弹出完成后,CLI仍可用于生成代码。
ng generate component blah
之类的命令仍然有效。