sveltejs / svelte-preprocess

A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
MIT License
1.73k stars 147 forks source link

fix: deprecate default export in favor of named export #641

Closed dummdidumm closed 2 weeks ago

dummdidumm commented 2 weeks ago

This deprecates the default export in favor of the new named export sveltePreprocess. It's done to ensure a better interop between CJS and ESM without resorting to hacks in the future. It also enables people using "module": "NodeNext" in their tsconfig.json to import without type errors. The sub exports were also adjusted so that the transpiled TS output doesn't include __importDefault wrappers, which makes Node's static analysis miss those named exports.

Related: https://github.com/sveltejs/svelte-preprocess/issues/591#issuecomment-2166807552

Before submitting the PR, please make sure you do the following

Tests