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

Allow using an alternate fs for lookup of sources #68

Closed
wants to merge 8 commits into from

Conversation

dazinator
Copy link
Contributor

@dazinator dazinator commented Dec 10, 2018

Opening this early, work is still in progress. Closes #65

  • Rebased on fixed tests on windows closes #66 #67 so that all the tests are in a good state on windows.
  • Allow an alternative fs implementation to be passed to Cabinet in options.
  • Update README to explain new options.fileSystem

Then for each resolver, it should honour using alternative fs if provided for access to sources:

@dazinator dazinator changed the title Issue 65 - Alterante FS Allow using an alternate fs for lookup of sources Dec 10, 2018
index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
@dazinator
Copy link
Contributor Author

Yep good reminder on the docs. I'll update those before the end.

@dazinator
Copy link
Contributor Author

Forward integrated with master branch and resolved a couple conflicts.

@dazinator
Copy link
Contributor Author

dazinator commented Mar 18, 2019

I've added a test to verify CommonJS lookup works, when using an alternative fs. The test fails currently, but once the module-definition dependency has had the outstanding PR merged, and we update it to the new version in package.json then the test should pass. Test passing.

@dazinator
Copy link
Contributor Author

@mrjoelkemp
I'm looking at the web pack resolver now!
I noticed that the webpack config file is brought in with a require call, and then executed if its a function:

 loadedConfig = require(webpackConfig);

    if (typeof loadedConfig === 'function') {
      loadedConfig = loadedConfig();
    }

I assume the require call means that node will resolve it on disk - meaning it will bypass the opportunity of going through an alternative fs implementation. Any thoughts on this? Do you think we could load it from an fs instead somehow? Or will the webpack config file always have to live on nodejs default 'fs`?

@mrjoelkemp
Copy link
Collaborator

@dazinator You can probably read it from your fs then json parse it.

@dazinator
Copy link
Contributor Author

dazinator commented Jul 4, 2019

Webpack enhanced resolve has now been updated to support passing a custom fs in:
webpack/enhanced-resolve#172 so can probably resume work on this now.

@dazinator
Copy link
Contributor Author

note to self: update to latest release of enhanced-resolve to provide custom fs implementation: https://www.npmjs.com/package/enhanced-resolve

@mrjoelkemp mrjoelkemp closed this Apr 30, 2022
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

Successfully merging this pull request may close these issues.

Allow alternative fs to be used for reading files.
2 participants