path-browserify icon indicating copy to clipboard operation
path-browserify copied to clipboard

require('path-browserify')

Open schkolne opened this issue 3 years ago • 2 comments

hmmm, the README says to write: var path = require('path')

that didn't work for me, however it did work when i wrote: var path = require('path-browserify')

i highly doubt the README is wrong given how many people use this package, scratching my head here a bit...

schkolne avatar May 04 '22 18:05 schkolne

The intent is for this package to be used in a bundling scenario, where your bundler will resolve require('path') to this package. This is what happens with browserify by default or with an appropriate resolve config in webpack. That way code that uses the node.js builtin path module can be bundled for the browser with no modifications.

goto-bus-stop avatar May 05 '22 07:05 goto-bus-stop

hmmm, the README says to write: var path = require('path')

that didn't work for me, however it did work when i wrote: var path = require('path-browserify')

i highly doubt the README is wrong given how many people use this package, scratching my head here a bit...

you can use patch-package to fix it and add path-browserify manually in dependencies when you don't have the browserify environment in your project, it works fine in my react-native project(it use the metro as a bundler)

assd12138 avatar Oct 27 '22 03:10 assd12138