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

v1.1 has a bug compared to v0 and v1.0: require can't take a number #41

Open
ljharb opened this issue Jul 3, 2022 · 3 comments
Open
Assignees
Labels

Comments

@ljharb
Copy link
Member

ljharb commented Jul 3, 2022

I get this error output in my tests:

  node:internal/validators:114
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type number (298)
    at new NodeError (node:internal/errors:388:5)
    at validateString (node:internal/validators:114:11)
    at Module.require (node:internal/modules/cjs/loader:1005:3)
    at require (node:internal/modules/cjs/helpers:102:18)

I suspect this was introduced in #31.

@ljharb ljharb assigned ghost and goto-bus-stop Jul 3, 2022
@ljharb ljharb changed the title v1 has a bug compared to v0: require can't take a number v1.1 has a bug compared to v0: require can't take a number Aug 7, 2022
@ljharb ljharb changed the title v1.1 has a bug compared to v0: require can't take a number v1.1 has a bug compared to v0 and v1.0: require can't take a number Aug 7, 2022
@goto-bus-stop
Copy link
Member

The browserify prelude uses the require function from the environment if a module is required that is not part of the bundle. That's mostly for bundle splitting but when running the bundle in Node.js, it picks up the Node.js require.

It seems like common-shakeify is somehow removing a module from the bundle but not removing the associated require call completely.

@ljharb
Copy link
Member Author

ljharb commented Oct 17, 2022

I would expect that, at the least, any require with an ID that doesn't exist in the bundle is replaced with the original name, for both fallback and debugging purposes :-)

Maybe that would always be a useful "final step" in any browserify bundle?

@ljharb
Copy link
Member Author

ljharb commented Feb 17, 2023

ping @goto-bus-stop

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

No branches or pull requests

2 participants