node.js - How to shim npm package dependency in browserify? -


so have react project, in i'm deploying react-lite footprint much smaller. i'd use react-nouislider, in it's package.json, i've found this:

"peerdependencies": {     "react": "^0.14.0" } 

what means whenever require react-nouislider, pulls in react instead of react-lite. how shim dependencies of npm package top-level package.json?

this how i'm shimming react-lite in:

"browser": {     "react": "react-lite" } 

and tried this, didn't work:

"browserify-shim":{     "react-nouislider": {         "depends": "react-lite"     } } 

how possible shim dependency of package itself?

browserify shim's tagline is:

makes commonjs incompatible files browserifyable.

your issue here react-lite commonjs compatible. commonjs compatible file, browserify automatically add dependencies , peerdependencies appropriate, before browserify shim gets involved.

i suggest change peerdependencies entry in react-nouislider package appropriate version of react-lite , remove browserify shim config above it's no longer needed. when this, sure run tests in react-nouislider package make sure still works react-lite instead of react. way of doing forking react-nouislider own repo, making change there, , pulling repo in package.json.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -