dreamcatcher-tech / dreamcatcher-stack

https://dreamcatcher.land
1 stars 0 forks source link

build a bundle for browser with all deps bundled as well #34

Closed inverted-capital closed 3 years ago

inverted-capital commented 3 years ago

working in all but glitch, as process not available for some reason.

Seems almost as if no polyfills being added to interblock dependencies by the live editor loaders. Learned that webpack 5 no longer polyfills node basics, but have a plugin to handle this in theory.

In conclusion, running in live editors is harsh to troubleshoot as we cannot see how their bundlers work. It is fair to assume that they expect web compatible modules to be used, tho. The problem appears to be because the live editors are not shimming node internal libraries before rendering in the browser.

Options for further progress:

  1. Downgrade to webpack 4
  2. Split into browser and server bundles
  3. Split out serverside modules such as dynamodb-lock-client into their own packages, to make a pure browser based package
  4. Make a vendor bundle with all interblock dependencies bundled in web compatible form - this will test if the live editor bundlers would have been able to bundle this codebase too. Must only obfuscate our primary bundle.
  5. Split vendor chunk into multiple pieces to determine offending modules - possibly generate one file per node_module so can know instantly
inverted-capital commented 3 years ago

works for codesandbox - stackblitz has an issue with loading deps of deps, so abandoning