Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ssr): add test for dynamic imports #4878

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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