Skip to content
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

When rootURL is the relative path, chunks are being output as absolute path. #639

Open
christophersansone opened this issue Sep 25, 2024 · 0 comments · May be fixed by #640
Open

When rootURL is the relative path, chunks are being output as absolute path. #639

christophersansone opened this issue Sep 25, 2024 · 0 comments · May be fixed by #640

Comments

@christophersansone
Copy link

Hi there! We are upgrading ember-auto-import from 1.x to the latest, and hit a snag that appears to be a bug.

In config/environments.js, we have rootURL set to an empty string so that all assets are loaded relative to where index.html is. Our app runs in many different environments, so for the sake of portability, all paths are relative, and {{rootURL}} returns an empty string as expected.

The script tags for the vendor and application Javascript files are correct:

<script src="assets/vendor.js"></script>
<script src="assets/application.js"></script>

For the chunk script tags, the expected behavior is for the path to be similarly relative:

<script src="assets/chunk.123.js"></script>

However, the actual behavior is that the path is outputting as absolute:

<script src="/assets/chunk.123.js"></script>

Here where publicAssetURL is determined, an empty rootURL returns /. This is due to ensureTrailingSlash always appending a / to the end of the string, even an empty string. By doing so, what should be relative paths are being output as absolute paths, thus causing 404's.

To me, the optimal fix would be for ensureTrailingSlash to only append a slash to the URL if the URL is actually present.

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

Successfully merging a pull request may close this issue.

1 participant