Skip to content

vite run using v0.22.1 gives "Cannot use 'import.meta' outside a module" #484

Closed
@rezelute

Description

@rezelute

Describe the bug

Hi,
When compiling the vite project after updating to v0.22.1 (v0.22.0 works fine), I am getting the following error:

SyntaxError: Cannot use 'import.meta' outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object._require.extensions.<computed> [as .js] (.../vite/dist/node/chunks/dep-71eb12cb.js:62910:17)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (C:\...\unplugin-vue-components\dist\vite.js:3:24)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)

The Vite version is: 3.0.4. Let me know if I can provide anything else to help debug.

Reproduction

Use vite with v0.22.1

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 15.68 GB / 31.92 GB
  Binaries:
    Node: 14.20.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.77)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions