rxaviers / react-globalize-webpack-plugin

react-globalize webpack plugin
Other
3 stars 8 forks source link

On 0.4.0, "No Globalize compiled data module found" if app makes no direct use of Globalize #14

Open rxaviers opened 8 years ago

rxaviers commented 8 years ago

Impact:

On 0.4.0, apps that uses react-globalize exclusively (i.e., without using Globalize directly) get No Globalize compiled data module found when compiling on production mode. The i18n chunks are build, but their order appears incorrectly in index.html, making app to fail loading.

Example: https://github.com/rxaviers/react-globalize-webpack-plugin/tree/example-for-14.

Quick workaround: Edit the built index.html and fix script loading order: vendor, i18n, app.

Cause:

On 0.4.x, when an app makes no direct use of Globalize, .createCompiledDataModule() is never called, therefore no module in no chunks are created as a compiled module. Note that data from react-globalize are extracted and compiled just fine, it just happens they are not flagged/marked by globalize-webpack plugin. A fix might probably need to go in globalize-webpack-plugin, but I'm filing the issue here because it's related to react-globalize-webpack-plugin.

rxaviers commented 8 years ago

Demo for this issue https://github.com/rxaviers/react-globalize-webpack-plugin/tree/example-for-14. Steps: npm install && npm run build.

mehcode commented 8 years ago

@rxaviers Anything I can do to help with this?

rxaviers commented 8 years ago

Hi @mehcode, it would be great if you could check the "Cause" in the description, use the demo above, and try to fix it. Just let me know if you have any questions. Thanks for your help.

ambrons commented 8 years ago

@rxaviers as you probably already know adding import Globalize from 'globalize'; fixes the above mentioned issue.

example fork

rxaviers commented 8 years ago

Hey @ambrons, thanks for your observation. Although, (if I understood correctly) your suggestion requires a change in the user code. Let's find out a solution in the plugin itself.

ambrons commented 8 years ago

@rxaviers yes you're correct it's a user space fix. Probably more of a workaround, but thought it was worth noting. If I get some time I'll try to do a deeper dive.