pmowrer / rollup-plugin-peer-deps-external

Automatically externalize `peerDependencies` in a rollup bundle.
MIT License
109 stars 16 forks source link

[Need help] My npm library not able to read peerDeps when I'm using it in Project. #63

Open vimalsharma081990 opened 5 months ago

vimalsharma081990 commented 5 months ago

[Need help] My npm library not able to read peerDeps when I'm using it in Project.

here is Rollup Config

import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import dts from 'rollup-plugin-dts'
import postcss from 'rollup-plugin-postcss'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'

export default [
  {
    input: 'src/index.ts',
    output: [
      {
        file: './lib/index.cjs.js',
        format: 'cjs',
        sourcemap: true
      },
      {
        file: './lib/index.esm.js',
        format: 'esm',
        sourcemap: true
      }
    ],
    plugins: [
      peerDepsExternal(),
      resolve(),
      commonjs(),
      typescript({tsconfig: './configs/tsconfig.json'}),
      postcss()
    ]
  }
]

package.json.peerDependencies


 "peerDependencies": {
    "react": "*",
    "react-dom": "*"
  }

Library link - https://github.com/BipanKishore/resizable-panes-react The project in which I am using it - https://github.com/BipanKishore/resizable-panes-testing

steps to reproduce:

In library/resizable-panes-react - npm i, npm start Above testing project - npm i, npm start npm link command will automatically connect them

Error: In browser console -> Uncaught TypeError: Cannot read properties of null (reading 'useEffect')

please provide solution