Closed mawoka-myblock closed 2 years ago
the problem doesn't occur if I use normal vite, only in SvelteKit and if I create a project with the following command:
npm create vite-extra@latest -- --template ssr-svelte
.
Just to clarify, do you mean it happens with npm create vite-extra@latest -- --template ssr-svelte
?
Also I think #8454 will fix this.
the problem doesn't occur if I use normal vite, only in SvelteKit and if I create a project with the following command:
npm create vite-extra@latest -- --template ssr-svelte
.Just to clarify, do you mean it happens with
npm create vite-extra@latest -- --template ssr-svelte
?Also I think #8454 will fix this.
Yes, it happens with npm create vite-extra@latest -- --template ssr-svelte
and I also think that the PR could fix it, but it is a (in my opinion) high priority bug, since it breaks a major feature, which worked before.
For a workaround, you could use this config:
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()],
ssr: {
noExternal: ['@fontsource/major-mono-display']
}
};
export default config;
Describe the bug
I am not able to import
.css
-files fromnode_modules
, e. g. fontsource-fonts or tippy.js styles, etc. I've submitted a reproduction-url to a SvelteKit-project, since the problem doesn't occur if I use normal vite, only in SvelteKit and if I create a project with the following command:npm create vite-extra@latest -- --template ssr-svelte
. The error deosn't occur when building the app, but in dev-mode and preview-mode.Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-nkr8q8?file=src/routes/index.svelte
System Info
Used Package Manager
pnpm
Logs
Click to expand!
```shell ❯ npm run preview -- --host 0.0.0.0 > vite-project@0.0.0 preview > cross-env NODE_ENV=production node server "--host" "0.0.0.0" Server started at http://localhost:5173 TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".css" for /tmp/vite-project/node_modules/@fontsource/marck-script/index.css at new NodeError (node:internal/errors:372:5) at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:80:11) at defaultGetFormat (node:internal/modules/esm/get_format:122:38) at defaultLoad (node:internal/modules/esm/load:21:20) at ESMLoader.load (node:internal/modules/esm/loader:431:26) at ESMLoader.moduleProvider (node:internal/modules/esm/loader:350:22) at new ModuleJob (node:internal/modules/esm/module_job:66:26) at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:369:17) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:328:34) at async ModuleWrap.Validations