FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]
https://www.snowpack.dev
Other
727 stars 96 forks source link

[webpack] add corejs support to webpack plugin #155

Closed FredKSchott closed 4 years ago

FredKSchott commented 4 years ago

Another follow up from #152 !

Our bundler plugin currently transpiles for your target browser, but it doesn't actually polyfill anything that it knows would be missing in that environment. This PR enabled automatic polyfilling for anything not supported by the target.

We use useBuiltIns: 'usage' so that this is automatic, and no import "core-js" statements are needed in your source code or unnecessarily installed during dev.

FredKSchott commented 4 years ago

Bah, it breaks #152 when added and then built in their app. Will need to dig into why this may be happening before merging.

Also, regeneratorRuntime is an interesting part of this: if you need to support browsers without async/await, you need a special second polyfill. Right now the workaround is to add import "regenerator-runtime/runtime.js"; to your app source code, but that means you'll be running the polyfill during dev.

FredKSchott commented 4 years ago

@drwpow PTAL, added comments inline