question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to emit file in @loadble/webpack-plugin

See original GitHub issue

🚀 Feature Proposal

Using @loadable in server rendered apps using webpack-dev-server that keeps output in memory is not working very well right now. One way to solve this would be to have an option to emit the file to disk.

I don’t have any knowledge regarding the webpack API and if it’s safe or not to do this. However I know there are atleast two webpack plugins that does this today already.

Motivation

I think think library is awesome and I’ve spent a couple of days implementing @loadable into our frontend platform. It works great but we also were in the process of switching build-system to razzle and that’s where I ran into a wall.

Razzle runs two instances of webpack (one for the server and one for the client). The client side of webpack generates the loadable-stats.json file and is kept in memory during development (razzle start). It’s currently very hard for the server to get a hold of this file…

Example

I’ve forked the @loadable/webpack-plugin and made some quick changes that seems to work well for us. As previously stated, I don’t know the implications of doing it like I have. I would need to get familiar with the webpack plugins API to tackle this issue.

Here’s a gist of the changes I’ve done: https://gist.github.com/marcneander/2bddd49fd3bd8c6065d8e51b221168a4

Right now I’m not capable of doing much coding outside of work. I might be able to convince my manager to let me spend a few hours on this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dlebedynskyicommented, Nov 21, 2018

Was just creating exact same thing https://gist.github.com/dlebedynskyi/7fd345f3d193bb78790c0e122e23012c

a bit more checks based on https://github.com/themgoncalves/react-loadable-ssr-addon/blob/master/source/ReactLoadableSSRAddon.js

also switch to emitAsync to handle error during file write - like EACCESS etc. Otherwise errors are swallowed

0reactions
gregbergecommented, Feb 5, 2019

Already done!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add option to emit file in @loadble/webpack-plugin · Issue #158
Using @loadable in server rendered apps using webpack-dev-server that keeps output in memory is not working very well right now. One way to ......
Read more >
loadable/webpack-plugin
LoadablePlugin. Create a webpack loadable plugin. Accepts boolean or object . Always write stats file to disk.
Read more >
emit-file-webpack-plugin - npm
Start using emit-file-webpack-plugin in your project by running `npm i emit-file-webpack-plugin`. There are no other projects in the npm ...
Read more >
Code Splitting - webpack
Code splitting is one of the most compelling features of webpack. This feature allows you to split your code into various bundles which...
Read more >
code splitting - Using loadable, common files are bundled into ...
How can I solve this? I want my files to be included in route bundle only. I don't want any common bundle. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found