From 795e054f3f1f074d51c4d618789004baba35af78 Mon Sep 17 00:00:00 2001 From: sapphi-red Date: Tue, 13 Jun 2023 17:21:51 +0900 Subject: [PATCH] test: restore test for #9353 --- .../backend-integration/__tests__/backend-integration.spec.ts | 2 ++ playground/backend-integration/dir/foo.css | 2 +- playground/backend-integration/frontend/dynamic/foo.css | 3 +++ playground/backend-integration/frontend/dynamic/foo.ts | 1 + playground/backend-integration/frontend/entrypoints/main.ts | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 playground/backend-integration/frontend/dynamic/foo.css create mode 100644 playground/backend-integration/frontend/dynamic/foo.ts diff --git a/playground/backend-integration/__tests__/backend-integration.spec.ts b/playground/backend-integration/__tests__/backend-integration.spec.ts index fa2a3d6070bb3d..442ed159219af9 100644 --- a/playground/backend-integration/__tests__/backend-integration.spec.ts +++ b/playground/backend-integration/__tests__/backend-integration.spec.ts @@ -37,6 +37,7 @@ describe.runIf(isBuild)('build', () => { const cssAssetEntry = manifest['global.css'] const scssAssetEntry = manifest['nested/blue.scss'] const imgAssetEntry = manifest['../images/logo.png'] + const dirFooAssetEntry = manifest['../dynamic/foo.css'] // '\\' should not be used even on windows expect(htmlEntry.css.length).toEqual(1) expect(htmlEntry.assets.length).toEqual(1) expect(cssAssetEntry?.file).not.toBeUndefined() @@ -46,6 +47,7 @@ describe.runIf(isBuild)('build', () => { expect(scssAssetEntry?.isEntry).toEqual(true) expect(imgAssetEntry?.file).not.toBeUndefined() expect(imgAssetEntry?.isEntry).toBeUndefined() + expect(dirFooAssetEntry).not.toBeUndefined() // use the entry name expect(manifest['bar.css']).not.toBeUndefined() expect(manifest['foo.css']).toBeUndefined() diff --git a/playground/backend-integration/dir/foo.css b/playground/backend-integration/dir/foo.css index c2fad7486d3ab6..1e31c585bebc9c 100644 --- a/playground/backend-integration/dir/foo.css +++ b/playground/backend-integration/dir/foo.css @@ -1,3 +1,3 @@ -.windows-path-foo { +.entry-name-foo { color: blue; } diff --git a/playground/backend-integration/frontend/dynamic/foo.css b/playground/backend-integration/frontend/dynamic/foo.css new file mode 100644 index 00000000000000..c2fad7486d3ab6 --- /dev/null +++ b/playground/backend-integration/frontend/dynamic/foo.css @@ -0,0 +1,3 @@ +.windows-path-foo { + color: blue; +} diff --git a/playground/backend-integration/frontend/dynamic/foo.ts b/playground/backend-integration/frontend/dynamic/foo.ts new file mode 100644 index 00000000000000..c2441c49231d80 --- /dev/null +++ b/playground/backend-integration/frontend/dynamic/foo.ts @@ -0,0 +1 @@ +import './foo.css' diff --git a/playground/backend-integration/frontend/entrypoints/main.ts b/playground/backend-integration/frontend/entrypoints/main.ts index f5a332191dd9e4..d63a57a023847e 100644 --- a/playground/backend-integration/frontend/entrypoints/main.ts +++ b/playground/backend-integration/frontend/entrypoints/main.ts @@ -1,4 +1,5 @@ import 'vite/modulepreload-polyfill' +import('../dynamic/foo') // should be dynamic import to split chunks export const colorClass = 'text-black'