Skip to content

Commit fc6fc24

Browse files
committed
Fix fastboot-script assets with cutom root url
When using custom rootURL specified in environment.js, the fastboot-script is still having relative path to local dist path, not containing rootURL path. The fastboot-script should not be ignored.
1 parent e6ff698 commit fc6fc24

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/fastboot/src/html-entrypoint.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function htmlEntrypoint(appName, distPath, htmlPath) {
2727
let relativeSrc = urlWithin(src, rootURL);
2828
if (relativeSrc) {
2929
scripts.push(path.join(distPath, relativeSrc));
30+
} else if (element.tagName === 'FASTBOOT-SCRIPT') {
31+
scripts.push(path.join(distPath, src));
3032
}
3133
}
3234
if (element.tagName === 'FASTBOOT-SCRIPT') {

packages/fastboot/test/html-entrypoint-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ describe('htmlEntrypoint', function() {
250250
<html>
251251
<meta name="my-app/config/environment" content="%7B%22rootURL%22%3A%22%2Fcustom-root-url%2F%22%7D" >
252252
<body>
253+
<fastboot-script src="foo.js"></fastboot-script>
253254
<script src="/custom-root-url/bar.js"></script>
254255
</body>
255256
</html>
@@ -259,6 +260,6 @@ describe('htmlEntrypoint', function() {
259260
fixturify.writeSync(tmpLocation, project);
260261

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

0 commit comments

Comments
 (0)