whilelucky / pwa

An opinionated progressive web app boilerplate
MIT License
357 stars 47 forks source link

Double import of `babel-polyfill`? #5

Closed lewiscowper closed 7 years ago

lewiscowper commented 7 years ago

Hi! It seems you import babel-polyfill in https://github.com/lakshyaranganath/pwa/blob/master/client/vendor/js/index.js#L1, and again in https://github.com/lakshyaranganath/pwa/blob/master/client/index.js#L1, is there a reason for the same import twice?

whilelucky commented 7 years ago

I have it imported in the vendor so that when the commonsChunkPlugin runs, it extracts it out into the vendor chunk only. It's the same reason for all the other import statements in vendor.js too, except that these modules export components/modules that have to be called manually to be executed. eg: ReactDOM.render()

But since in this case just running import 'babel-polyfill'; directly performs the polyfilling. I think removing it from client/index.js makes sense because vendor.js is executed before main.js in the final output html.

Pushed the change :) Good catch, there's really no need to have it run twice 👍