如何导出@angular-cli的webpack项目配置

前端之家收集整理的这篇文章主要介绍了如何导出@angular-cli的webpack项目配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
ng new mobile --style scss -si
npm i --registry=https://registry.npm.taobao.org # 如果安装提示失败,进行下一步安装 
npm i

然后验证项目是否可以正常运行
ng serve
如果有编译成功说明项目一切正常

npm eject
完成后会发现.angular-cli.json文件的project小节里面多了,ejected:true

这时会输出如下信息:
==========================================================================================
Ejection was successful.

To run your builds,you now need to do the following commands:
   - "npm run build" to build.
   - "npm 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".

同时在项目的根目录下会多出一个文件:webpack.config.js,里面的内容就是当前项目的webpack配置

更新新增加的包
npm install

npm start # 就可以使用webpack-dev-server启动项目

如果有报错,就看下这里:https://github.com/angular/an...

我只碰到提示说,package.json文件内容必须包含pree2e

天之骄子

2017.8.14 星期一 深圳

原文链接:https://www.f2er.com/angularjs/146467.html

猜你在找的Angularjs相关文章