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

Use babel #625

Open
alkorlos opened this issue Feb 5, 2024 · 0 comments
Open

Use babel #625

alkorlos opened this issue Feb 5, 2024 · 0 comments

Comments

@alkorlos
Copy link

alkorlos commented Feb 5, 2024

Hello!
Thank you for functional library!

Describe the bug
Need to use babel, the example from the documentation is not working, and I can't figure out why.

Testing on @babel/plugin-transform-unicode-sets-regex
src\App.svelte:

<script>
 <!-- ... -->

  const re = new RegExp("/[\p{ASCII}&&\p{Decimal_Number}]/v")
  console.log(re)
</script>

In the dist\assets\index-name.js expecting

/[0-9]/u

But there is no transpilation happening.

Logs
No Logs with error.

To Reproduce
svelte-preprocess-issue-babel

Doing this:
npm create vite@latest, options: Svelte, JavaScript
npm install svelte-preprocess @babel/core @babel/preset-env --save
Update svelte.config.js:

import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
import preprocess from 'svelte-preprocess'

export default {
  preprocess: [
    vitePreprocess(),
    preprocess({
      babel: {
        presets: [
          [
            '@babel/preset-env',
            {
              loose: true,
              modules: false,
              targets: {
                esmodules: true,
              },
            },
          ],
        ],
      },
    })
  ],
}

That's all.

Did I miss a step in the documentation?

Expected behavior
Expected transpilation JS.

Stacktraces
No Stacktraces.

Information about your project:

  • Your browser and the version: Chrome 121

  • Your operating system: Windows 10 10.0.19045

  • svelte-preprocess version 5.1.3

  • Whether your project uses: Vite and Rollup

Additional context
No Additional context.

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

No branches or pull requests

1 participant