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

Generalize the "dynamic fs.readFileSync" hack #4

Open
deathcap opened this issue Feb 9, 2015 · 0 comments
Open

Generalize the "dynamic fs.readFileSync" hack #4

deathcap opened this issue Feb 9, 2015 · 0 comments

Comments

@deathcap
Copy link
Owner

deathcap commented Feb 9, 2015

Much of webnpm is handling the need for npm and browserify to synchronously read files whose filenames are not given as string literal arguments. If they were, brfs could be used to inline their contents at build time. Since they are not, webnpm replaces calls to readFileSync with its own function that returns file contents from an object of 'preloaded' files, currently:

  'node_modules/browserify/node_modules/umd/template.js',
  'node_modules/browserify/node_modules/browser-pack/_prelude.js',
  'node_modules/npm/package.json',

maybe this is worth generalizing into a browserify transform module? (or adding as an enhancement to brfs? not sure if it fits)

Note: fs.readFile (async) is bridged to web-fs, but that API is async and has no synchronous equivalent by design — though see also #3 (if switch to a different fs-compatible filesystem backend, may be able to also implement fs.readFileSync)

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

No branches or pull requests

1 participant