-
Notifications
You must be signed in to change notification settings - Fork 11.9k
ng serve compiles sucessfully even if some assets are missing #6689
Copy link
Copy link
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: @angular-devkit/build-angularfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity2: inconvenient
Milestone
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: @angular-devkit/build-angularfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity2: inconvenient
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug Report or Feature Request (mark with an
x)Versions.
@angular/cli: 1.1.0
node: 7.8.0
os: win32 x64 //(Windows 7)
@angular/animations: 4.1.3
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/platform-server: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.1.0
@angular/compiler-cli: 4.1.3
Repro steps.
assetsarray.The log given by the failure.
webpack: Compiled successfullywhen doingng serveDesired functionality.
I expected some sort of "file not found" error to appear.
Mention any other details that might be useful.
I'm trying to use a JavaScript file as a Service Worker. I cannot put it in
/assets/folder because that would change the scope of the SW to/assets/instead of/(I tried doing that, and I had to useserviceWorker.register('/assets/sw.js')or Angular couldn't find the file). I'd like to put the file on the root, so I can have a root scope for my SW.Working with the angular-cli.json file I realized there is no way of testing if the file I'm referencing to is recognized somehow by Angular CLI when doing
ng serveso I tried to add a non-existant file in order to purposefully generate an error while compiling, which did not happen. So I have no way of checking if my asset references are correct or not. I tried doing<script src="sw.js"></script>at theindex.htmlfile and adding aconsole.login order to check if the file is loaded or not. The sw.js file is in thesrcfolder, and some relevant lines from the angular-cli.json file are the following:And the SW registration script in my index.html:
So I cannot find a way to include sw.js as an asset. I heard of Angular Mobile, but I want to start with something simpler first.
I used as reference to implement my SW the following:
Thank you.