simonihmig / ember-cli-bundle-analyzer

Analyze the size and contents of your Ember app's bundles
MIT License
99 stars 2 forks source link

UnrecognizedURLError when using Service Worker (esw-index) #16

Closed smellyung closed 1 year ago

smellyung commented 5 years ago

I've installed ember-cli-bundle-analyzer, tried to run it (build and serve process not running at the same time like the previous closed issue), and I'm getting this error message:

Error: Assertion Failed: The URL '/_analyze' did not match any routes in your application
    at assert (ember.debug.js:13696)
    at errorFor (ember.debug.js:36286)
    at onerrorDefault (ember.debug.js:36272)
    at Object.trigger (ember.debug.js:52531)
    at ember.debug.js:53428
    at invokeWithOnError (ember.debug.js:9037)
    at Queue.flush (ember.debug.js:8923)
    at DeferredActionQueues.flush (ember.debug.js:9086)
    at Backburner.end (ember.debug.js:9165)
    at Backburner.run (ember.debug.js:9244)
simonihmig commented 5 years ago

Weird...

Do you see any error message while starting ember serve? What version of node and Ember CLI are you using? You can see that the addon has been successully added to package.json?

Mike-Neto commented 5 years ago

I was able to replicate this issue as well using ember-service-worker, after I installed it, this issue started showing up, Do you use it as well?

simonihmig commented 5 years ago

Ah @Mike-Neto, thanks for chiming in!

That makes totally sense. I think https://github.com/DockYard/ember-service-worker-index will intercept any network request for any HTML content (see https://github.com/DockYard/ember-service-worker-index/blob/master/service-worker/index.js#L41), and serve the ember app's static index.html instead. Adding _analyze to its excludeScope config would hopefully fix this!

Mike-Neto commented 5 years ago

Yeah, that fixed the issue for me, adding: 'esw-index': { excludeScope: [/_analyze/], },

to my ember-cli-build.js.