Service Worker ng build --prod build fails with CLI 1.5.3
Versions
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.5.3
Node: 8.9.1
OS: darwin x64
Angular: 5.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker
@angular/cli: 1.5.3
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.3
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1
Repro steps
ng new myApp --service-worker=truecd myAppng build --prod
Observed behavior
The installed version of @angular/service-worker is 5.0.2. This version of the CLI
requires the @angular/service-worker version to satisfy >= 1.0.0-beta.5 < 2.0.0. Please upgrade
your service worker version.
Desired behavior
prod build works without this error because its the modern sw
Mention any other details that might be useful (optional)
Same problem here
As far as I know the new Service Worker is not implemented in angular-cli yet. Maybe it will come with angular-cli 1.6, but the new service worker comes with a cli tool on itself you can use.
@wambowams yes I heard that as well, but then it confuses me that the offer the --service-worker flag already.
Like @webmaxru explains in his angularconnect-slides that the feature comes with angular-cli 1.6 The steps from slide26 don't work either then with angular-cli 1.5.3
Hence any suggestions how to use it or just wait until the release @hansl ?
I tried this tutorial: https://medium.com/google-developer-experts/a-new-angular-service-worker-creating-automatic-progressive-web-apps-part-2-practice-3221471269a1 But some other errors occurred regarding the caching functionality.
Please run:
npm install -g @angular/cli@next
if you have it installed local run
npm install @angular/cli@next
and then make sure to move your ngsw-config.json to the root folder @wambowams I also used that tutorial and coupled with this I got it up and running
@kenisteward thanks a lot 👍 Fortunately the 1.6.0-rc0 was released 2 hours ago.
No more copying of the ngsw-config.json is needed. The new cli does it out of the box
This works for me:
# make sure you have 1.6
npm i -g @angular/cli@next
ng new myApp --service-worker=true
ng build --prod
Versions
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.0-rc.0
Node: 8.9.1
OS: darwin x64
Angular: 5.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker
@angular/cli: 1.6.0-rc.0
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.21
@angular-devkit/schematics: 0.0.37
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0-rc.0
@schematics/angular: 0.1.7
typescript: 2.4.2
webpack: 3.8.1
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.