ng 弹出的目的是什么? [英] What is the purpose of ng eject?
问题描述
文档对此主题非常简短:
ng injection
弹出你的应用程序并输出正确的 webpack 配置和脚本
ng eject
ejects your app and output the proper webpack configuration and scripts
这个命令的目的是什么?
What is the purpose of this command?
推荐答案
angular-cli 很神奇,一切都以简单而自动的方式完成.
angular-cli is something magic, everything is done in a simple and automatic way.
但有时,您可能想对包的完成方式采取行动、添加插件,或者您只是想看看它所基于的 Webpack 配置.
But sometimes, you may want to act on how the package is done, add a plugin or you are simply curious to see the Webpack configuration on which it is based.
当运行 ngject
时,会生成一个 webpack.config.json
文件.查看文件 package.json
你会发现要启动的命令略有改变:
When running ng eject
, you generate a webpack.config.json
file. Looking at the file package.json
you will see that the commands to launch have slightly changed:
ng serve --> npm start
ng build --> npm run build
ng e2e --> npm run e2
<小时>
如果你想撤消 ng弹出
,你必须编辑你的.angular.cli.json
文件并设置弹出
为假:
If you want to undo ng eject
, you will have to edit your .angular.cli.json
file and set ejected
to false:
"project": {
...
"ejected": false
}
这篇关于ng 弹出的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!