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

cannot use import statement outside of a module #3907

Closed
shedali opened this issue Jun 22, 2021 · 3 comments
Closed

cannot use import statement outside of a module #3907

shedali opened this issue Jun 22, 2021 · 3 comments

Comments

@shedali
Copy link

shedali commented Jun 22, 2021

npx npm init @vitejs/app storybook-vite
- chose svelte
- chose svelte-ts

[vite-plugin-svelte] failed to import config /Users/franz/dev/kipling-stack/kipling-ui/app/storybook-vite/svelte.config.js
/Users/franz/dev/kipling-stack/kipling-ui/app/storybook-vite/svelte.config.js:1
import sveltePreprocess from 'svelte-preprocess'
^^^^^^

SyntaxError: Cannot use import statement outside a module

rename svelte.config.js to svelte.config.mjs and it works
node v16.2.0

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

 System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 3.11 GB / 64.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.2.0 - ~/n/bin/node
    Yarn: 1.22.10 - ~/n/bin/yarn
    npm: 7.13.0 - ~/n/bin/npm
  Browsers:
    Brave Browser: 91.1.25.73
    Chrome: 91.0.4472.77
    Firefox: 88.0.1
    Firefox Developer Edition: 74.0
    Safari: 14.1.1
  npmPackages:
    vite: ^2.3.7 => 2.3.8

Used package manager: npm

@dominikg
Copy link
Contributor

duplicate of #3834

@patak-dev
Copy link
Member

Closed with #3835

@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants