export-size icon indicating copy to clipboard operation
export-size copied to clipboard

Error when using this with React

Open uchihamalolan opened this issue 3 years ago • 0 comments

Describe the bug

When bundler is rollup, there is some error when trying to execute export packages

I think this issue might be fixed if @rollup/plugin-commonjs is used


npx export-size . --bundler "rollup"
████████████████████████████████████████ 0/0 Error: 'jsx' is not exported by node_modules/react/jsx-runtime.js, imported by dist/coms
    at error (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:198:30)
    at Module.error (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:12543:16)
    at Module.traceVariable (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:12902:29)
    at ModuleScope.findVariable (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:11554:39)
    at FunctionScope.findVariable (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:6486:38)
    at ChildScope.findVariable (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:6486:38)
    at Identifier.bind (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:7553:40)
    at CallExpression.bind (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:5383:23)
    at CallExpression.bind (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:9049:15)
    at ReturnStatement.bind (/Users/malolan/.npm/_npx/614a55f223c4d059/node_modules/rollup/dist/shared/rollup.js:5383:23) {
  code: 'MISSING_EXPORT',
  url: 'https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module',
  id: '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/Alert/index.js',
  pos: 9,
  loc: {
    column: 9,
    file: '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/Alert/index.js',
    line: 1
  },
  frame: "1: import { jsx } from 'react/jsx-runtime';\n" +
    '            ^\n' +
    "2: import { Alert } from 'antd';",
  watchFiles: [
    'export-size-virtual',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/Heyo.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/Hello/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/World/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/Counter/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/CurrentUserBio/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/CashAppsQueryClient/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/pages/Payments/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/utils/fetcher.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/utils/query-client.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/dist/components/Alert/index.js',
    '/Users/malolan/Growfin/pkgexp/cashapps/node_modules/react/jsx-runtime.js'
  ]

Reproduction

https://github.com/ma101an/cashapps

System Info

System:
    OS: macOS 12.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 36.62 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.1 - ~/Library/Caches/fnm_multishells/73842_1659985333292/bin/node
    Yarn: 1.22.15 - ~/Library/Caches/fnm_multishells/73842_1659985333292/bin/yarn
    npm: 8.12.1 - ~/Library/Caches/fnm_multishells/73842_1659985333292/bin/npm
    Watchman: 2022.03.21.00 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 103.1.41.100
    Firefox Developer Edition: 104.0
    Safari: 15.6

Used Package Manager

npm

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.

uchihamalolan avatar Aug 08 '22 20:08 uchihamalolan