You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 12, 2021. It is now read-only.
I'm using the official guide for building an Angular Universal project using the CLI. However, the application won't run when importing ServiceWorkerModule. It gives this error:
/project/node_modules/@angular/service-worker/companion/module.js:1
(function (exports, require, module, __filename, __dirname) { import { NgModule } from '@angular/core';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.kEM4 (/project/dist-server/main.bundle.js:1:256573)
at n (/project/dist-server/main.bundle.js:1:211)
From what I understand, this issue is caused because @angular/service-worker needs to be packaged using commonjs. Here are some official guidelines for packaging I found.
I'm using the official guide for building an Angular Universal project using the CLI. However, the application won't run when importing
ServiceWorkerModule. It gives this error:From what I understand, this issue is caused because
@angular/service-workerneeds to be packaged usingcommonjs. Here are some official guidelines for packaging I found.