Skip to content

Commit

Permalink
test(ssr): add test for dynamic imports (#4878)
Browse files Browse the repository at this point in the history
Co-authored-by: Will Harney <[email protected]>
  • Loading branch information
nolanlawson and wjhsf authored Nov 18, 2024
1 parent 88bf8a7 commit cd36585
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ async function compileFixture({
plugins: [
lwcRollupPlugin({
enableDynamicComponents: true,
experimentalDynamicComponent: {
loader: path.join(__dirname, './utils/custom-loader.js'),
strictSpecifier: false,
},
modules: [
{
dir: modulesDir,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<x-dynamic-component>
<template shadowrootmode="open">
Importee:
</template>
</x-dynamic-component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-dynamic-component';
export { default } from 'x/dynamic';
export * from 'x/dynamic';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
Importee: {importee}
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { LightningElement } from 'lwc';

export default class DynamicCtor extends LightningElement {
importee

constructor() {
super()
import('x/fake').then(result => {
this.importee = result
})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default "do not actually import me"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function load() {
return Promise.resolve('stub');
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const expectedFailures = new Set([
'comments-text-preserve-off/index.js',
'dynamic-components/slots/shadow/index.js',
'dynamic-components/slots/light/index.js',
'dynamic-imports/basic/index.js',
'dynamic-slots/index.js',
'empty-text-with-comments-non-static-optimized/index.js',
'if-conditional-slot-content/index.js',
Expand Down

0 comments on commit cd36585

Please sign in to comment.