Skip to content

Commit

Permalink
Merge pull request #853 from ember-fastboot/html-entry
Browse files Browse the repository at this point in the history
Fix fastboot-script assets with cutom root url
  • Loading branch information
xg-wang authored Aug 23, 2021
2 parents e6ff698 + fc6fc24 commit 9a471e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/fastboot/src/html-entrypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ function htmlEntrypoint(appName, distPath, htmlPath) {
let relativeSrc = urlWithin(src, rootURL);
if (relativeSrc) {
scripts.push(path.join(distPath, relativeSrc));
} else if (element.tagName === 'FASTBOOT-SCRIPT') {
scripts.push(path.join(distPath, src));
}
}
if (element.tagName === 'FASTBOOT-SCRIPT') {
Expand Down
3 changes: 2 additions & 1 deletion packages/fastboot/test/html-entrypoint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ describe('htmlEntrypoint', function() {
<html>
<meta name="my-app/config/environment" content="%7B%22rootURL%22%3A%22%2Fcustom-root-url%2F%22%7D" >
<body>
<fastboot-script src="foo.js"></fastboot-script>
<script src="/custom-root-url/bar.js"></script>
</body>
</html>
Expand All @@ -259,6 +260,6 @@ describe('htmlEntrypoint', function() {
fixturify.writeSync(tmpLocation, project);

let { scripts } = htmlEntrypoint('my-app', tmpLocation, 'index.html');
expect(scripts).to.deep.equal([`${tmpLocation}/bar.js`]);
expect(scripts).to.deep.equal([`${tmpLocation}/foo.js`, `${tmpLocation}/bar.js`]);
});
});

0 comments on commit 9a471e5

Please sign in to comment.