#Fresh Vite install has import error

1 messages · Page 1 of 1 (latest)

flint bane
#

Hey everyone,

I'm creating a fresh create vite@latest and after installing modules and running npm run dev I'm getting these error:


✘ [ERROR] Expected identifier but found "import"

    (define name):1:0:
      1 │ import.meta.dirname
        ╵ ~~~~~~

✘ [ERROR] Expected identifier but found "import"

    (define name):1:0:
      1 │ import.meta.filename
        ╵ ~~~~~~

✘ [ERROR] Expected identifier but found "import"

    (define name):1:0:
      1 │ import.meta.url
        ╵ ~~~~~~

failed to load config from /Users/rickmeima/Documents/GitHub/react-servicemanager/vite.config.js
error when starting dev server:
Error: Build failed with 3 errors:
(define name):1:0: ERROR: Expected identifier but found "import"
(define name):1:0: ERROR: Expected identifier but found "import"
(define name):1:0: ERROR: Expected identifier but found "import"```
#

I haven't touched anything besides creating, installing modules and running. I've tried a few times with no luck

autumn carbon
#

yes i am also facing the same issue

viral horizon
#

me too

lapis plank
#

rename vite.config.ts to vite.config.ts.mts, my project is work by this way.

uncut bloom
#

hey i'm also getting the same error from this morning. the quick solution is we have to change the version vite to ^5.4.10 in package.json. this is just temporary solution.

viral horizon
#

thanks man