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:
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.
Hi there! We are upgrading
ember-auto-import
from1.x
to the latest, and hit a snag that appears to be a bug.In
config/environments.js
, we haverootURL
set to an empty string so that all assets are loaded relative to whereindex.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:
For the chunk script tags, the expected behavior is for the path to be similarly relative:
However, the actual behavior is that the path is outputting as absolute:
Here where
publicAssetURL
is determined, an emptyrootURL
returns/
. This is due toensureTrailingSlash
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.