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

"http2" module #2921

Open
nwtgck opened this issue Apr 13, 2019 · 6 comments

Comments

@nwtgck
Copy link

commented Apr 13, 2019

Hi, developers! Thank you for your very convenient project.

❔ Question

Could you tell me Parcel supports "http2" module?

πŸ”¦ Context

const http2 = require("http2"); causes an error "Cannot resolve dependency 'http2'".
require("http") worked well.

πŸ’» Code Sample

Here is my index.js

// index.js
const http2 = require("http2");

http2.createServer((req, res)=>{
  res.end("hello, world\n");
}).listen(3000, ()=>{
  console.log("Listening...");
});

Here is how to build.

./node_modules/.bin/parcel build index.js --target=node --bundle-node-modules --no-cache

Here is the complete code: https://github.com/nwtgck/public-code/tree/master/parcel-http2

🌍 Your Environment

Software Version(s)
Parcel 1.12.3
Node v10.15.0
npm/Yarn npm 6.8.0
Operating System macOS 10.12.6
@mischnic

This comment has been minimized.

Copy link
Member

commented May 31, 2019

Parcel uses this list of node builtin modules: https://github.com/webpack/node-libs-browser/blob/master/index.js

EDIT: http2 and async_hooks are missing
It looks like we'll have to create our own version of that package because was actually deprecated a few days ago.

@DeMoorJasper

This comment has been minimized.

Copy link
Member

commented Jun 1, 2019

Unfortunately that list is missing a lot more than just http2

@azz

This comment has been minimized.

@mischnic

This comment has been minimized.

Copy link
Member

commented Jun 20, 2019

A package like that (a list of strings) isn't enough for our usecase, because some of these modules are actually polyfilled when bundling for the browser (e.g. buffer or path)

@azz

This comment has been minimized.

Copy link

commented Jun 20, 2019

Ah I see. Not possible to use a separate package for polyfills and determining builtins?

@mischnic

This comment has been minimized.

Copy link
Member

commented Jun 20, 2019

Yes, I guess we could use some existing (maintained) package to make sure the builtin list is correct and use our own polyfill list

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