Upgrading from [email protected] to the angular-cli@webpack
To update angular-cli
to the webpack preview, you must update both the global package, project's local package and your project files.
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@webpack
# commit any changes you have to git first
rm -rf node_modules dist tmp typings
npm install --save-dev angular-cli@webpack
IMPORTANT NOTE:
Currently project generated with ng new
will use a wrong local CLI version (see angular#1528). After initializing your project, run npm install --save-dev angular-cli@webpack
to set the correct version.
You will need to run ng init
to check for changes in all the auto-generated files created by ng new
and allow you to update yours. You are offered four choices for each changed file: y
(overwrite), n
(don't overwrite), d
(show diff between your file and the updated file) and h
(help).
Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after ng init
finishes.
You can find a sample github diff of the changes introduced between a beta.10 and webpack preview project at https://github.com/filipesilva/angular-cli-webpack-upgrade/commit/HEAD.
Here is a summary of the file changes:
- Updated files:
./config/karma.conf.js
-frameworks
/plugins
/files
/exclude
/preprocessors
entries changed, addedangularCliConfig
entry../e2e/tsconfig.json
- property cleanup, changedoutdir
, addedtypeRoots
./angular-cli.json
- updated version entry../README.md
- updated version entry, removed route from generator list../package.json
- removed typings postinstall script, removedember-cli-inject-live-reload
/es6-shim
/systemjs
dependencies, addedcore-js
/ts-helpers
dependencies, updatedangular-cli
/codelyzer
/ts-node
/ts-lint
/typescript
devDependencies, added@types/jasmine
/@types/protractor
/karma-coverage
devDependencies../src/app/app.component.ts
(and all other components) - removedmodule.id
, sass/less/stylus preprocessing now uses the real extension instyleUrls
instead of.css
../src/app/index.ts
- import adjusted due to environment files moving (see below)../src/index.html
- removed templating tags andSystemJS
import script../src/app/tsconfig.json
- property cleanup, changedoutdir
/module
, addedlibs
/typeRoots
/types
./src/typings.d.ts
- addedSystem
/require
typings, removedtypings
ref
- Mobile app updated files:
./package.json
- local versions ofangular2-universal
now used by the build system, updated package versions../src/index.html
- moved service worker code to build system, hardcoded icons../src/main-app-shell.ts
- reworked to interface with the build system, see comments in file.
- New files:
./src/polyfills.ts
- loads needed polyfills before main app./src/test.ts
- unit test spec loader
- These files have moved to
./src/app/environments/
:
./config/environment.dev.ts
./config/environment.prod.ts
./src/app/environment.ts
Lastly, you can delete these files as they are not needed anymore.
./config/karma-test-shim.js
./config/environment.js
./src/system-config.ts
./angular-cli-build.js
./typings.json
./.clang-format
(if present)