PatrickJS / NG6-starter

:ng: An AngularJS Starter repo for AngularJS + ES6 + Webpack
https://angularclass.github.io/NG6-starter
Apache License 2.0
1.9k stars 1.35k forks source link

DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'file://./' cannot be created in a document with origin 'null' and URL 'file:///dist/index.html'. #221

Closed roymj88 closed 7 years ago

roymj88 commented 7 years ago

Hi Guys,

While taking dist, im hitting this error which constantly refreshes the page.

vendor.bundle.js?dc17209…:10 DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'file://./' cannot be created in a document with origin 'null' and URL 'file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/index.html'.
    at ve.u.url (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:8:25567)
    at s (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:9:30702)
    at file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:10:448
    at d.$digest (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:10:12923)
    at d.$apply (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:10:14737)
    at file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:8:9141
    at Object.a [as invoke] (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:8:22674)
    at a (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:8:9062)
    at ct (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:8:9346)
    at lt (file:///Users/TheRedDevil/Projects/ng6/Source/Web/dist/vendor.bundle.js?dc172094010e4fd21817:8:8584)

I have tried adding the same in a web server also.

Starting Chrome in --allow-file-access-from-files mode is not possible as this would be deployed to client server.

Also i cannot find in my code base where this pushState is being used.

Note: Ive tried cloning this repo freshly and the error exist for me there too.

fesor commented 7 years ago

Also i cannot find in my code base where this pushState is being used.

This is part of $location service.

I have tried adding the same in a web server also.

Did you check locally with webpack-dev-server for example? You could start it by running npm start.

as this would be deployed to client server.

In this case you will have some document origin.

Feel free to ask if you still have problems. But I closing this right now.