Comments (2)
If something works with npm, and not with an alternative package manager, then it seems likely to be a bug in that package manager. If pnpm, or yarn, or anyone else is placing things in a different location than npm does, then it's responsible for also ensuring that standard module resolution APIs act as if things are in an npm-installed location.
Have you filed an issue on pnpm to investigate? If there's something in browserify then a fix ofc can be investigated, but it seems worth checking with pnpm first.
from browserify.
Hi @ljharb, thanks for mentioning it! About opening it on pnpm
, from what I read yesterday, when an issue is tooling related, it's something that pnpm
wont solve, according to this:
Also, we had a similar issue in the past which was open there and solved in browserify/module-deps
:
pnpm/pnpm#795
browserify/module-deps#133
I ended up deciding to open it here because I saw an issue that involved the same package (is-buffer
), which was solved in browserify/insert-module-globals
:
#1825.
browserify/insert-module-globals#75.
Also, since it has something to do with patching Buffer.isBuffer
(which seems to be browserify's responsibility) I thought this would be the right place.
One more thing to add, if I change the call in browserify/insert-module-globals
from path.relative
to path.resolve
, it ends up bundling things correctly:
diff --git a/index.js b/index.js
index dfc2664..3c35f03 100644
--- a/index.js
+++ b/index.js
@@ -10,7 +10,7 @@ var isbufferPath = require.resolve('is-buffer')
var combineSourceMap = require('combine-source-map');
function getRelativeRequirePath(fullPath, fromPath) {
- var relpath = path.relative(path.dirname(fromPath), fullPath);
+ var relpath = path.resolve(path.dirname(fromPath), fullPath);
// If fullPath is in the same directory or a subdirectory of fromPath,
// relpath will result in something like "index.js", "src/abc.js".
// require() needs "./" prepended to these paths.
However, there's one test that ends up failing because of this: https://github.com/browserify/insert-module-globals/blob/0549e4372523ec2c967058b0bfce51fad9038b0f/test/isbuffer.js#L22.
from browserify.
Related Issues (20)
- [spam]
- Unexpected character '#' HOT 1
- visitor[(override || node.type)] is not a function HOT 2
- Dump offending code when acorn complains about syntax error HOT 4
- querystring API considered legacy by npm HOT 1
- require fs-js in browser does not work after creating and including Bundle HOT 1
- TypeError: this.buffers[pos.buf].get is not a function
- ااااا HOT 1
- Calling bundle file from react gives Syntax error: react_app_testing/src/HashBundle.js: Unexpected character '�' (1:0) HOT 7
- Archive this repository HOT 7
- Doc: Typescript support
- Hey Some one please help :- browserify error with webtorrent HOT 3
- Browserify + common-shakeify + Chart.js = infinite stack trace HOT 2
- ERROR in ./node_modules/ ... in ReactJs HOT 2
- Getting error `require is not defined` HOT 4
- Stop browserify from evaluating dynamic imports ( import() ) and crashing? HOT 3
- Where do I put flags in config?
- Browserify fails to resolve default node module used within an external package HOT 7
- [spam]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browserify.