Skip to content
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

Merged
merged 4 commits into from
Apr 3, 2023

Conversation

PuruVJ
Copy link
Collaborator

@PuruVJ PuruVJ commented Apr 3, 2023

This moves all code snippets to imports rather than the current require. Only exception is svelte/register

@vercel
Copy link

vercel bot commented Apr 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-dev-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 8:59pm

@PuruVJ PuruVJ changed the base branch from master to sites April 3, 2023 19:25
@PuruVJ PuruVJ marked this pull request as draft April 3, 2023 19:26
const svelte = require('svelte/compiler');
const sass = require('node-sass');
import svelte from 'svelte/compiler';
import sass from 'node-sass';
Copy link
Collaborator Author

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

Copy link
Member

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

Copy link
Collaborator Author

@PuruVJ PuruVJ Apr 3, 2023

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

Copy link
Member

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 😄

@PuruVJ PuruVJ marked this pull request as ready for review April 3, 2023 19:30
@@ -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).
Copy link
Collaborator Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benmccann benmccann merged commit beb3f65 into sites Apr 3, 2023
@benmccann benmccann deleted the feat/cjs-to-esm-code-examples branch April 3, 2023 22:29
@gtm-nayan gtm-nayan mentioned this pull request Jun 17, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants