Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem requiring npm packages that themselves require npm packages #14

Closed
johnnyreilly opened this Issue Aug 30, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@johnnyreilly
Copy link

johnnyreilly commented Aug 30, 2015

Hi,

First of all, thanks for Browserify - I love it!

I've recently been turning my attention to web workers and I've experienced some teething problems using webworkify. The example has you requiring gamma and using it successfully. However, I've had problems with module resolution when I try and require / import protobufjs.

The workaround seems to be switching from

var ProtoBuf = require("protobufjs");

to

var ProtoBuf = require("../../node_modules/protobufjs");

I note that the main for gamma is the index.js in the root of the package. In the case of ProtobufJS there's an index.js in the root which requires "dist/ProtoBuf.js". Also, in the main the package points to "dist/ProtoBuf.js".

It looks like there might be an issue with webworkify being used to require packages that themselves require other packages.

nickpeihl pushed a commit to nickpeihl/turf-async that referenced this issue Feb 19, 2016

Nick Peihl
Incorporate geobuf for passing geojson
According to mapbox/mapbox-gl-js#1504 the
transferring of GeoJSON files between main and worker threads can cause
a bottleneck. We should be able to reduce this bottleneck by converting
and passing the GeoJSON file created in the Worker as a geobuf and
decoding it on the main thread.

This commit is broken because of a possible bug with Webworkify not
pulling in correct dependencies. See
browserify/webworkify#14
@mourner

This comment has been minimized.

Copy link
Collaborator

mourner commented Sep 7, 2016

Hey, do you think this issue is still relevant? I haven't been able to reproduce this, and webworkify works fine with a very complicated dependency tree in projects like https://github.com/mapbox/mapbox-gl-js. Please let me know if there's still a problem and I'll reopen — this could be a browserify bug that got fixed.

@mourner mourner closed this Sep 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.