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

Build error in version 0.16.4 #294

Closed
5 tasks done
woqk opened this issue Jul 12, 2023 · 2 comments
Closed
5 tasks done

Build error in version 0.16.4 #294

woqk opened this issue Jul 12, 2023 · 2 comments

Comments

@woqk
Copy link

woqk commented Jul 12, 2023

Describe the bug

Version 0.16.3 works well, but latest version give an error.


failed to load config from /home/projects/github-mgbdfs/vite.config.ts
error when starting dev server:
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/projects/github-mgbdfs/node_modules/.pnpm/unplugin-icons@0.16.4/node_modules/unplugin-icons/dist/vite.js from /home/projects/github-mgbdfs/vite.config.ts not supported.
Instead change the require of vite.js in /home/projects/github-mgbdfs/vite.config.ts to a dynamic import() which is available in all CommonJS modules.
    at InternalError.get (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:385021)
    at Module._extensions..js (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:259510)
    at _require.] (/home/projects/github-mgbdfs/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:64579:17)
    at Module.load (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:257700)
    at Module._load (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:255119)
    at Module.require (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:258018)
    at i (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:514801)
    at _0x216930 (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:42:144147)
    at Object.eval (/home/projects/github-mgbdfs/vite.config.ts:38:28)
    at Object.function (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:42:144956)
    at Module._compile (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:259006)
    at _require.] (/home/projects/github-mgbdfs/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:64576:24)
    at Module.load (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:257700)
    at Module._load (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:255119)
    at Module.require (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:258018)
    at i (https://githubmgbdfs-equ4.w-credentialless.staticblitz.com/blitz.e809191e.js:35:514801)
    at loadConfigFromBundledFile (/home/projects/github-mgbdfs/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:64584:21)
    at async loadConfigFromFile (/home/projects/github-mgbdfs/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:64440:28)
    at async resolveConfig (/home/projects/github-mgbdfs/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:64045:28)
    at async _createServer (/home/projects/github-mgbdfs/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63326:20)
    at async CAC.eval (/home/projects/github-mgbdfs/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/cli.js:748:24)
 ELIFECYCLE  Command failed with exit code 1.

vite.config.ts

import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import Icons from 'unplugin-icons/vite';

export default defineConfig({
  plugins: [solidPlugin(), Icons({ compiler: 'solid' })],
  server: {
    port: 3000,
  },
  build: {
    target: 'esnext',
  },
});

Reproduction

https://stackblitz.com/edit/github-mgbdfs?file=vite.config.ts,tsconfig.json,package.json

System Info

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 74.52 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.3.1 - /opt/homebrew/bin/node
    Yarn: 1.22.18 - /opt/homebrew/bin/yarn
    npm: 9.6.7 - /opt/homebrew/bin/npm
    pnpm: 8.6.3 - /opt/homebrew/bin/pnpm
  Browsers:
    Brave Browser: 114.1.52.122
    Chrome: 114.0.5735.198
    Safari: 16.5.1
    Safari Technology Preview: 17.0

Used Package Manager

pnpm

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.
@zhangtao25
Copy link

@antfu 这是一个bug,没锁lock.json会G

@antfu
Copy link
Member

antfu commented Jul 12, 2023

Should be fixed in 0.16.5

@antfu antfu closed this as completed Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants