Download vite-nested-dynamic-import-css/tests/test.patch from dari-ai/vite-selfbench: direct link, hf CLI and curl.
- Browser
- Download file 3.58 kB
-
https://huggingface.co/datasets/dari-ai/vite-selfbench/resolve/main/vite-nested-dynamic-import-css/tests/test.patch
- Command line
-
hf download hf://datasets/dari-ai/vite-selfbench/vite-nested-dynamic-import-css/tests/test.patch
-
curl -L -o test.patch https://huggingface.co/datasets/dari-ai/vite-selfbench/resolve/main/vite-nested-dynamic-import-css/tests/test.patch
3.58 kB
| diff --git a/playground/dynamic-import/__tests__/dynamic-import.spec.ts b/playground/dynamic-import/__tests__/dynamic-import.spec.ts | |
| index 384f41902..2008aef5b 100644 | |
| --- a/playground/dynamic-import/__tests__/dynamic-import.spec.ts | |
| +++ b/playground/dynamic-import/__tests__/dynamic-import.spec.ts | |
| test('should work with load ../ and contain itself directory', async () => { | |
| .toMatch('dynamic-import-nested-self-content') | |
| }) | |
| +// #22700: nested `import('a').then(() => import('b'))` where `a` has a CSS | |
| +// side-effect dep — the outer import's CSS must still be loaded in build output | |
| +test('should load css of nested dynamic import', async () => { | |
| + await expect | |
| + .poll(() => page.textContent('.then-css-outer')) | |
| + .toMatch('then-css-outer') | |
| + await expect.poll(() => getColor('.then-css-outer')).toBe('red') | |
| + await expect | |
| + .poll(() => page.textContent('.then-css-inner')) | |
| + .toMatch('then-css-inner') | |
| + await expect.poll(() => getColor('.then-css-inner')).toBe('green') | |
| +}) | |
| + | |
| test('should work a load path that contains parentheses.', async () => { | |
| await expect | |
| .poll(() => | |
| diff --git a/playground/dynamic-import/index.html b/playground/dynamic-import/index.html | |
| index 1289efc3e..a5a0832ba 100644 | |
| --- a/playground/dynamic-import/index.html | |
| +++ b/playground/dynamic-import/index.html | |
| <div class="dynamic-import-nested-self"></div> | |
| +<div class="then-css-outer">todo</div> | |
| +<div class="then-css-inner">todo</div> | |
| + | |
| <script type="module" src="./nested/index.js"></script> | |
| <script type="module" src="./(app)/nest/index.js"></script> | |
| <style> | |
| diff --git a/playground/dynamic-import/nested/index.js b/playground/dynamic-import/nested/index.js | |
| index 6520e1f5a..c6e9ee406 100644 | |
| --- a/playground/dynamic-import/nested/index.js | |
| +++ b/playground/dynamic-import/nested/index.js | |
| import(`../nested/static.js`).then((mod) => { | |
| text('.dynamic-import-static', mod.self) | |
| }) | |
| +// #22700: in a nested `import().then(() => import())`, the outer import's CSS | |
| +// dep used to be dropped to `void 0` in the build output, orphaning the CSS. | |
| +import('./then-css/outer.js').then((outerMod) => { | |
| + text('.then-css-outer', outerMod.outer) | |
| + return import('./then-css/inner.js').then((innerMod) => { | |
| + text('.then-css-inner', innerMod.inner) | |
| + }) | |
| +}) | |
| + | |
| console.log('index.js') | |
| diff --git a/playground/dynamic-import/nested/then-css/inner.css b/playground/dynamic-import/nested/then-css/inner.css | |
| new file mode 100644 | |
| index 000000000..9855e17de | |
| --- /dev/null | |
| +++ b/playground/dynamic-import/nested/then-css/inner.css | |
| +.then-css-inner { | |
| + color: #008000; | |
| +} | |
| diff --git a/playground/dynamic-import/nested/then-css/inner.js b/playground/dynamic-import/nested/then-css/inner.js | |
| new file mode 100644 | |
| index 000000000..01624aa99 | |
| --- /dev/null | |
| +++ b/playground/dynamic-import/nested/then-css/inner.js | |
| +import './inner.css' | |
| +export const inner = 'then-css-inner' | |
| diff --git a/playground/dynamic-import/nested/then-css/outer.css b/playground/dynamic-import/nested/then-css/outer.css | |
| new file mode 100644 | |
| index 000000000..f829bca5b | |
| --- /dev/null | |
| +++ b/playground/dynamic-import/nested/then-css/outer.css | |
| +.then-css-outer { | |
| + color: #ff0000; | |
| +} | |
| diff --git a/playground/dynamic-import/nested/then-css/outer.js b/playground/dynamic-import/nested/then-css/outer.js | |
| new file mode 100644 | |
| index 000000000..4e1516b99 | |
| --- /dev/null | |
| +++ b/playground/dynamic-import/nested/then-css/outer.js | |
| +import './outer.css' | |
| +export const outer = 'then-css-outer' | |