Skip to content

Commit

Permalink
fix: use correct dev bundling endpoint for content and fallback (#136)
Browse files Browse the repository at this point in the history
* fix: use correct dev bundling endpoint for content and fallback

* test: fix test urls
  • Loading branch information
digitalsadhu authored Dec 11, 2023
1 parent cd0f384 commit 680cff1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plugins/mode-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default fp(
fastify.scriptsList.push({
value: development
? // in development, we fetch from the development on the fly bundler endpoint
joinURLPathSegments(prefix, `/_/dynamic/files/content.js`)
joinURLPathSegments(prefix, `/_/dynamic/element/content/${appName}`)
: // where as in production, we use the production build
joinURLPathSegments(base, `/client/content.js`),
// add scope hint so the podlet or layout will only use this script for successful content requests
Expand All @@ -32,7 +32,7 @@ export default fp(
// @ts-ignore
fastify.scriptsList.push({
value: development
? joinURLPathSegments(prefix, `/_/dynamic/files/fallback.js`)
? joinURLPathSegments(prefix, `/_/dynamic/element/fallback/${appName}`)
: joinURLPathSegments(base, `/client/fallback.js`),
scope: 'fallback',
type: 'module',
Expand Down
8 changes: 4 additions & 4 deletions test/lib/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ test('scripts: plugin mounted under /app, development mode urls', async (t) => {
'/app/_/dynamic/modules/@lit-labs/ssr-client/lit-element-hydrate-support.js',
);
t.equal(mJson.js[1].value, '/app/_/dynamic/files/scripts.js');
t.equal(mJson.js[2].value, '/app/_/dynamic/files/content.js');
t.equal(mJson.js[2].value, '/app/_/dynamic/element/content/test-app');
t.equal(mJson.js[2].scope, 'content');
t.equal(mJson.js[3].value, '/app/_/dynamic/files/fallback.js');
t.equal(mJson.js[3].value, '/app/_/dynamic/element/fallback/test-app');
t.equal(mJson.js[3].scope, 'fallback');
await app.close();
});
Expand Down Expand Up @@ -275,9 +275,9 @@ test('lazy: plugin mounted under /app, development mode urls', async (t) => {
t.equal(mJson.js[0].strategy, 'beforeInteractive');
t.equal(mJson.js[1].value, '/app/_/dynamic/files/lazy.js');
t.equal(mJson.js[1].strategy, 'lazy');
t.equal(mJson.js[2].value, '/app/_/dynamic/files/content.js');
t.equal(mJson.js[2].value, '/app/_/dynamic/element/content/test-app');
t.equal(mJson.js[2].scope, 'content');
t.equal(mJson.js[3].value, '/app/_/dynamic/files/fallback.js');
t.equal(mJson.js[3].value, '/app/_/dynamic/element/fallback/test-app');
t.equal(mJson.js[3].scope, 'fallback');
await app.close();
});
Expand Down

0 comments on commit 680cff1

Please sign in to comment.