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

add writeToDisk option to webpack plugin #161

Merged
merged 2 commits into from
Nov 23, 2018

Conversation

dlebedynskyi
Copy link
Contributor

Summary

Adds option to emit file on build 158 by adding writeToDisk (default to false) to plugin options

Test plan

Test required app that runs 2 instances of webpack - client and server.
Client webpack instance need to generate file that is later used by server instance.
Razzle app maybe be a good candidate for that test

Example of usage

Default

// add plugin instance in webpack for client config
 plugins: [new LoadablePlugin()]

with emit file

// 👇 generate absolute path to target file 
const filename = path.resolve(root, 'dist/loadable-stats.json'); 

// add plugin instance in webpack for client config
 plugins: [new LoadablePlugin({filename:  writeToDisk: true})]

@gregberge
Copy link
Owner

gregberge commented Nov 22, 2018

OK for me, @marcneander can you confirm that it works for your razzle example?

@marcneander
Copy link
Contributor

It works great 👍 I created my razzle example in his branch. Would have loved to have added it to this PR but I don't think it's possible so I created a new PR.

Let's get this merged and published. We're already running this code in our platform :)

@gregberge
Copy link
Owner

I can't merge it right now, documentation is not up to date. @dlebedynskyi can you update readme?

@willdurand
Copy link

// add plugin instance in webpack for client config
plugins: [new LoadablePlugin({filename: writeToDisk: true})]

I suppose, there is a comma after filename, no?

FWIW, I currently use this plugin to (I guess) do the same thing: https://github.com/gajus/write-file-webpack-plugin.

@gregberge gregberge merged commit 6b5ba21 into gregberge:master Nov 23, 2018
@dlebedynskyi
Copy link
Contributor Author

I suppose, there is a comma after filename, no?
@willdurand my bad.

Thanks for merge and coma fix @neoziro.

@dlebedynskyi dlebedynskyi deleted the dl/write-to-disk branch November 26, 2018 18:36
dlebedynskyi added a commit to dlebedynskyi/loadable-components that referenced this pull request Nov 26, 2018
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.

4 participants