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

node_modules missing files published in the package #2014

Closed
dekz opened this issue Jun 3, 2019 · 7 comments · May be fixed by codesandbox/dependency-packager#9
Closed

node_modules missing files published in the package #2014

dekz opened this issue Jun 3, 2019 · 7 comments · May be fixed by codesandbox/dependency-packager#9

Comments

@dekz
Copy link

dekz commented Jun 3, 2019

🐛 bug report

Description of the problem

Not all of the required files seem to be present in the node_modules folder.

i.e:

var rng = require('./lib/rng');
var bytesToUuid = require('./lib/bytesToUuid');

From https://unpkg.com/[email protected]/v4.js. This ./lib/rng file is required but not present under node_modules.

image

How has this issue affected you? What are you trying to accomplish?

Unable to render correctly to demo.

Link to sandbox: link

Your Environment

Software Name/Version
Сodesandbox
Browser
Operating System
@CompuIves
Copy link
Member

Hey @dekz, that's true, we download files on-demand based on the requires. We do that to save bandwidth, otherwise people have to download hundreds of mbs to load the demo.

I took a look at your example, and I think that we're loading a wrong version of uuid, we load 2.0.3:
image

and the lib/rng logic seems to be in v3.

I'm looking into why we're loading [email protected], in the meantime you can "fix" it by explicitly adding [email protected] to your dependencies.

@dekz
Copy link
Author

dekz commented Jun 6, 2019

@CompuIves thanks for the update. Did you get a successful compilation with hoisting the dependency up?

When adding [email protected]:

Could not find module in path: 'uuid/2.0.1/lib/rng' relative to '/node_modules/uuid/2.0.1/v4.js'

@CompuIves
Copy link
Member

CompuIves commented Jun 6, 2019

Ohhh, good point! I found out that we have trouble with a single dependency that has multiple transient dependencies of a specific dependency.

So in the case of 0x.js there are two versions of uuid, and we only pick the 2.0.3 from it.

From what I've seen:

➜  t yarn why uuid
yarn why v1.16.0
warning package.json: No license field
[1/4] 🤔  Why do we have the module "uuid"...?
[2/4] 🚚  Initialising dependency graph...
warning No license field
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "uuid"
info Reasons this module exists
   - Hoisted from "0x.js#@0x#contract-wrappers#uuid"
   - Hoisted from "web3-provider-engine#request#uuid"
   - Hoisted from "0x.js#@0x#subproviders#ganache-core#ethereumjs-wallet#uuid"
info Disk size without dependencies: "108KB"
info Disk size with unique dependencies: "108KB"
info Disk size with transitive dependencies: "108KB"
info Number of shared dependencies: 0
=> Found "ethers#[email protected]"
info This module exists because "0x.js#ethers" depends on it.
info Disk size without dependencies: "96KB"
info Disk size with unique dependencies: "96KB"
info Disk size with transitive dependencies: "96KB"
info Number of shared dependencies: 0
=> Found "ethereumjs-blockstream#[email protected]"
info This module exists because "0x.js#@0x#contract-wrappers#ethereumjs-blockstream" depends on it.
info Disk size without dependencies: "108KB"
info Disk size with unique dependencies: "108KB"
info Disk size with transitive dependencies: "108KB"
info Number of shared dependencies: 0
=> Found "web3-eth-accounts#[email protected]"
info This module exists because "0x.js#@0x#subproviders#ganache-core#web3#web3-eth#web3-eth-accounts" depends on it.
info Disk size without dependencies: "96KB"
info Disk size with unique dependencies: "96KB"
info Disk size with transitive dependencies: "96KB"
info Number of shared dependencies: 0
✨  Done in 0.44s.

We need to add support for this, allow for multiple transient dependencies of the same name with different versions. I'm thinking of what a workaround for now is.

A weird thing is that we only take hoisted dependencies, so it should've given v3.

@CompuIves
Copy link
Member

It seems to work when removing @0x/subproviders from the dependency list, since it's also included in 0x.js, but I can also understand that you don't want to change the sandbox that much.

@dekz
Copy link
Author

dekz commented Jun 6, 2019

Dang you found that quick. Removing the @0x/subproviders does indeed help with the issue. It is included in 0x.js, but not everything is exported out via 0x.js.

Good temporary workaround.

@github-actions
Copy link

github-actions bot commented Sep 4, 2020

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

@github-actions github-actions bot added the stale label Sep 4, 2020
@github-actions
Copy link

This issue has been automatically closed because there wasn't any activity after the previous notice or the stale label wasn't removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants