Open bfontaine opened 7 months ago
From what I understand, the Svelte extractor uses its own preprocess
config and so ignores the one in svelte.config.js
.
Edit: indeed, if I modify node_modules/svelte-i18n-lingui/dist/extractor.js
to include the {scss: {prependData: "..."}}
config in the sveltePreprocess()
call, it works:
index 990434b..bb7fb3c 100644
--- extractor.js
+++ extractor.js
@@ -130,7 +130,7 @@ export const svelteExtractor = {
try {
const { code: processedCode, map: _processedMap } = await preprocess(
source,
- [sveltePreprocess()],
+ [sveltePreprocess({scss:{prependData: "@import './src/theme/app.scss';"}})],
{ filename }
);
Hello,
When you use the
prependData
key of the SCSS preprocessor to make SCSS variables global to the app and use these implicitely-defined variables in a component,npm run extract
crashes because it can’t find them:See a minimal example here: https://github.com/bfontaine/my-lingui-app This is the SvelteKit demo app with svelte-i18n-lingui and an
app.scss
that defines a single variable, asvelte.config.js
that prepends it in the scss preprocessor, and a component that uses the variable.The build works without any issue, so
npm extract
should somehow be able to handle this.Any idea? Thanks in advance!