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 failed with rollup #283

Open
5 tasks done
KarasuShin opened this issue May 15, 2023 · 0 comments
Open
5 tasks done

build failed with rollup #283

KarasuShin opened this issue May 15, 2023 · 0 comments

Comments

@KarasuShin
Copy link

Describe the bug

I got some error messages while building with rollup:

CleanShot 2023-05-15 at 15 09 57@2x

rollup.config.js

import { defineConfig } from 'rollup'
import iconPlugin from 'unplugin-icons/rollup'
import typescriptPlugin from '@rollup/plugin-typescript'

const config = defineConfig({
  input: ['src/index.tsx'],
  output: {
    format: 'es',
    dir: 'dist',
    preserveModules: true,
  },
  plugins: [
    typescriptPlugin(),
    iconPlugin({
      compiler: 'jsx',
      jsx: 'react',
    }),
  ],
  external: [
    'react/jsx-runtime',
    'react',
  ],
})

export default config

tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "useDefineForClassFields": true,
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "ESNext",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "types": ["unplugin-icons/types/react"]
  },
  "include": ["src"]
}

src/index.tsx

import UserIcon from '~icons/carbon/user'

export const Icon = () => <UserIcon />

Reproduction

https://github.com/KarasuShin/unplugin-icons-rollup-reproduction

System Info

System:
    OS: macOS 13.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 107.00 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.14.0 - ~/Library/Caches/fnm_multishells/8359_1683852025838/bin/node
    Yarn: 1.22.15 - /usr/local/bin/yarn
    npm: 9.3.1 - ~/Library/Caches/fnm_multishells/8359_1683852025838/bin/npm
    Watchman: 2023.04.24.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 113.0.5672.92
    Safari: 16.4

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.
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

1 participant