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

Svelte support via Vite #16513

Open
lambtron opened this issue Nov 2, 2022 · 1 comment
Open

Svelte support via Vite #16513

lambtron opened this issue Nov 2, 2022 · 1 comment
Labels
bug Something isn't working correctly node compat

Comments

@lambtron
Copy link
Contributor

lambtron commented Nov 2, 2022

Running into a TypeError when trying to add an import statement in vite.config.mjs. I'm on MacOS Intel i5.

Reproduce:

  1. Run deno run -A --unstable npm:create-vite-extra and selecting deno-svelte
  2. Update vite.config.mjs to
import { defineConfig } from 'npm:vite'
import { svelte } from 'npm:@sveltejs/vite-plugin-svelte'

import "npm:svelte";
import "npm:svelte-routing";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [svelte()]
})
  1. Run dev deno run -A --unstable --node-modules-dir npm:vite

Error message:

failed to load config from /Users/andyjiang/Developer/deno/blog/how-to-series/svelte/vite.config.mjs
error when starting dev server:
TypeError: 'import', and 'export' cannot be used outside of module code at file:///Users/andyjiang/Developer/deno/blog/how-to-series/svelte/node_modules/.deno/svelte-routing@1.6.0/node_modules/svelte-routing/src/index.js:1:1
    at async loadConfigFromBundledFile (file:///Users/andyjiang/Developer/deno/blog/how-to-series/svelte/node_modules/.deno/vite@3.2.2/node_modules/vite/dist/node/chunks/dep-c842e491.js:64010:21)
    at async loadConfigFromFile (file:///Users/andyjiang/Developer/deno/blog/how-to-series/svelte/node_modules/.deno/vite@3.2.2/node_modules/vite/dist/node/chunks/dep-c842e491.js:63895:28)
    at async resolveConfig (file:///Users/andyjiang/Developer/deno/blog/how-to-series/svelte/node_modules/.deno/vite@3.2.2/node_modules/vite/dist/node/chunks/dep-c842e491.js:63519:28)
    at async createServer (file:///Users/andyjiang/Developer/deno/blog/how-to-series/svelte/node_modules/.deno/vite@3.2.2/node_modules/vite/dist/node/chunks/dep-c842e491.js:62819:20)
    at async CAC.<anonymous> (file:///Users/andyjiang/Developer/deno/blog/how-to-series/svelte/node_modules/.deno/vite@3.2.2/node_modules/vite/dist/node/cli.js:707:24)
@littledivy littledivy added bug Something isn't working correctly node compat labels Nov 2, 2022
@birkskyum
Copy link
Contributor

This is only breaking for me because of the "npm:svelte-routing" now. It's running if I don't alter the vite.config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

No branches or pull requests

3 participants