Skip to content

Commit 3a55b59

Browse files
committed
fix: move CSS side-effect imports to .js shim so tsc doesn't fight bundler
1 parent 5be47ba commit 3a55b59

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

examples/micro-app/ssr-micro-shared/src/index.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
// CSS side-effect imports — own them at the federation root so consumers
22
// don't need to import workspace-dep stylesheets (which rsbuild silently
3-
// drops). Each consuming remote reaches ssr-micro-shared anyway, and the
4-
// host's renderHost emits `<link>` for these chunks from this manifest.
5-
// @ts-expect-error CSS handled by bundler loader, not tsc.
6-
import './styles/tokens.css';
7-
// @ts-expect-error CSS handled by bundler loader, not tsc.
8-
import './styles/components.css';
3+
// drops). The actual `import './*.css'` lives in a sibling .js shim so tsc
4+
// stays out of bundler-only concerns. Each consuming remote reaches
5+
// ssr-micro-shared anyway, and the host's renderHost emits `<link>` for
6+
// these chunks from this manifest.
7+
import './styles/index.js';
98

109
export { renderSSRHead } from 'unhead/server';
1110
export type { ActiveHeadEntry, Unhead, UseHeadInput } from 'unhead/types';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Pure JS so tsc doesn't try to resolve `.css` modules.
2+
// rspack/rsbuild/vite all handle these via their CSS loaders.
3+
import './tokens.css';
4+
import './components.css';

examples/micro-app/ssr-micro-vite-vue/src/app.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@
6161
</template>
6262

6363
<script setup lang="ts">
64-
// @ts-expect-error CSS handled by bundler loader, not tsc.
65-
import 'ssr-micro-shared/src/styles/tokens.css';
66-
// @ts-expect-error CSS handled by bundler loader, not tsc.
67-
import 'ssr-micro-shared/src/styles/components.css';
64+
// CSS loaded via shared package's JS shim — keeps tsc out of bundler-only paths.
65+
import 'ssr-micro-shared/src/styles/index.js';
6866
6967
import { useRouter } from '@esmx/router-vue';
7068
import { useHead } from '@unhead/vue';

0 commit comments

Comments
 (0)