-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(site-2): CJS to ESM for code snippets #8449
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const svelte = require('svelte/compiler'); | ||
const sass = require('node-sass'); | ||
import svelte from 'svelte/compiler'; | ||
import sass from 'node-sass'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe update this to use dart-sass? Recommending something as obnoxious as node-sass can't be a good impression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's what svelte-preprocess
does, so I guess it wouldn't hurt to change for consistency: https://github.com/sveltejs/svelte-preprocess/blob/537b97536c2a48574ca748dccf3fcc0dc6d3ffc5/src/transformers/scss.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
svelte preprocess uses a deprecated API of sass
, so I tested on staclkblitz with new compileStringAsync
API, works, so gonna keep that here https://stackblitz.com/edit/node-ncrbch?file=index.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you should send it as a PR to svelte-preprocess
as well 😄
@@ -238,9 +238,9 @@ The `script` and `style` functions receive the contents of `<script>` and `<styl | |||
If a `dependencies` array is returned, it will be included in the result object. This is used by packages like [rollup-plugin-svelte](https://github.com/sveltejs/rollup-plugin-svelte) to watch additional files for changes, in the case where your `<style>` tag has an `@import` (for example). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about vite-plugin-svelte?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This moves all code snippets to imports rather than the current require. Only exception is svelte/register