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

Fix file linting, handle asynchronous virtual files #12

Merged
merged 1 commit into from
Jun 12, 2017

Conversation

rangoo94
Copy link
Contributor

It may be pretty common to asynchronously generate file, so I prepared a code (with backwards compatibility) to allow also async functions (with promises)

@rmarscher rmarscher merged commit bd34586 into rmarscher:master Jun 12, 2017
@rmarscher
Copy link
Owner

@rangoo94 I like your approach here. An attempt at this was made in #11 but we couldn't seem to get webpack to wait for the async resolution. I confirmed that your code had the same problem by adding a 1 second delay. Webpack tries to resolve the module before before it is populated. It doesn't seem to use the callback function in the resolve plugin to delay execution. I haven't been able to figure out how to deal with this. It would require a deeper dive into the webpack internals to figure out if it's possible. Feel free to give it another try based on the current master here.

I did merge your changes and added a few additional changes of my own. I published this to NPM as v0.2.1.

Webpack supports exporting a Promise for the webpack.config.js. I documented an approach for async file contents in the README.md that involves resolving the contents first and then returning the webpack config. I updated your contents-async integration test to use this approach. I left your version commented out and also have commented out code for delaying the content resolve by 1 second.

Thanks a lot for the pull.

/cc @papandreou

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.

2 participants