unplugin / unplugin-icons

🤹 Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
3.66k stars 131 forks source link

Setting prefix to false or empty string gives error and tries importing false #273

Open spa5k opened 1 year ago

spa5k commented 1 year ago

Describe the bug

Unexpected token (Note that you need plugins to import files that are not JavaScript)
file: /home/spark/Codes/quran/tanzil/src/providers/app.tsx:10:7
 8: import { useEffect } from 'react';
 9: import { Spinner } from '/home/spark/Codes/quran/tanzil/src/components/Elements/Spinner/Spinner.tsx';
10: import false from '~icons/fa/lse.tsx';
           ^
11: const queryClient = new QueryClient();
12: export const AppProvider = () => {
error during build:
RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error (file:///home/spark/Codes/quran/node_modules/.pnpm/rollup@3.10.1/node_modules/rollup/dist/es/shared/rollup.js:2041:30)
    at Module.error (file:///home/spark/Codes/quran/node_modules/.pnpm/rollup@3.10.1/node_modules/rollup/dist/es/shared/rollup.js:13062:16)
    at Module.tryParse (file:///home/spark/Codes/quran/node_modules/.pnpm/rollup@3.10.1/node_modules/rollup/dist/es/shared/rollup.js:13737:25)
    at Module.setSource (file:///home/spark/Codes/quran/node_modules/.pnpm/rollup@3.10.1/node_modules/rollup/dist/es/shared/rollup.js:13347:39)
    at ModuleLoader.addModuleSource (file:///home/spark/Codes/quran/node_modules/.pnpm/rollup@3.10.1/node_modules/rollup/dist/es/shared/rollup.js:22929:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
/home/spark/Codes/quran/tanzil:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  tanzil-react@0.0.0 build: `vite build`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

Works well if there is some prefix

Reproduction

https://github.com/spa5k/quran

For the reproduction of issue, please clone the repo, and in tanzil/vite.config.ts change IconResolver settings to have prefix to false, or empty string.

System Info

System:
    OS: Linux 5.15 Arch Linux
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 4.58 GB / 7.64 GB
    Container: Yes
    Shell: 5.9 - /opt/distrod/alias/usr/bin/zsh
  Binaries:
    Node: 19.7.0 - ~/.nvm/versions/node/v19.7.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v19.7.0/bin/npm

Used Package Manager

pnpm

Validations