1

My React SSR app loads modules at runtime when it knows which are needed.

Webpack splits and bundles the code.

The SSR app is hosted on server A, and the bundles must, for reasons beyond my control, be hosted on server B.

How can I let Webpack know to load the modules from B, not A?

Lee Goddard
  • 10,680
  • 4
  • 46
  • 63
  • 1
    For SSR import you need bundled modules on the same server. Then you can also upload bundles on different hosting for imports resolved in the browser. This is your case? – aqquadro Jun 05 '18 at 13:16
  • @aqquadro — I found and posted the answer. I wanted the bundles on a different host to that which produces the SSR document that will invoke the bundles. – Lee Goddard Jun 05 '18 at 15:46

1 Answers1

0

Setting [publicPath][1] to an absolute URL solved the problem.

Lee Goddard
  • 10,680
  • 4
  • 46
  • 63