Skip to content

Javascript bundles referenced with invalid absolute paths in "index.html" when building app #1572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TAGC opened this issue Jun 14, 2018 · 2 comments

Comments

@TAGC
Copy link

TAGC commented Jun 14, 2018

Version

3.0.0-rc.1

Reproduction link

TAGC/vue-expandable-grid@fe08cb8

Steps to reproduce

After cloning and installing dependencies, run $ ./node_modules/.bin/vue-cli-service build ./src/index.ts in the project root directory. This should generate dist/index.html and app/vendor bundles under dist/js. Open dist/index.html in a browser and confirm it gets 404s trying to load the bundles.

What is expected?

dist/index.html to be generated where it references the bundles as relative paths:

<body>
    <div id=app></div>
    <script src=./js/chunk-vendors.0676a3e4.js></script>
    <script src=./js/app.1196cf87.js></script>
</body>

What is actually happening?

The HTML file gets generated referencing the bundles at invalid absolute paths:

<body>
    <div id=app></div>
    <script src=/js/chunk-vendors.0676a3e4.js></script>
    <script src=/js/app.1196cf87.js></script>
</body>

Manually changing the absolute paths to relative paths after generating the HTML file causes the JS bundles to be loaded successfully.

@Akryum
Copy link
Member

Akryum commented Jun 14, 2018

Are you trying to open the page directly from your file explorer? If so, it won't work since you are not on a real HTTP server. To test your deploy locally, you can use for example this small utility which can expose your files in an HTTP server on localhost just like if you would have uploaded them on a real server.

@TAGC
Copy link
Author

TAGC commented Jun 14, 2018

Ah okay, that's awesome thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants