unconfig
unconfig copied to clipboard
"SyntaxError: Unexpected identifier" when loading vite.config with `@sveltejs/vite-plugin-svelte` or `vite-plugin-solid` plugins
Describe the bug
I encountered this error when using unocss vscode extention. I already opened issue in unocss repo https://github.com/unocss/unocss/issues/2088.
When I try to load vite.config with @sveltejs/vite-plugin-svelte
or vite-plugin-solid
plugin i get this error.
/home/melkam/unconfig-bug/node_modules/.pnpm/[email protected][email protected]/node_modules/vitefu/src/index.js:15
const { createRequire } = (await Promise.resolve().then(() => require('module'))).default;
^^^^^^^
SyntaxError: Unexpected identifier
at new Script (node:vm:100:7)
at createScript (node:vm:259:10)
at Object.runInThisContext (node:vm:307:10)
at jiti (/home/melkam/unconfig-bug/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:5:24838)
at /home/melkam/unconfig-bug/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite-plugin-solid/dist/esm/index.mjs:8:15
at jiti (/home/melkam/unconfig-bug/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:5:25030)
at /home/melkam/unconfig-bug/vite.config.ts:2:47
at jiti (/home/melkam/unconfig-bug/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:5:25030)
at loadConfigFile (file:///home/melkam/unconfig-bug/node_modules/.pnpm/[email protected]/node_modules/unconfig/dist/index.mjs:145:11)
at async Object.load (file:///home/melkam/unconfig-bug/node_modules/.pnpm/[email protected]/node_modules/unconfig/dist/index.mjs:74:24)
at async file:///home/melkam/unconfig-bug/test.ts:1:47
Reproduction
https://codesandbox.io/p/sandbox/unconfig-vite-solid-bug-2wrobj
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 6.14 GB / 7.74 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
Used Package Manager
pnpm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.