Skip to content

Commit

Permalink
Revert "Framework: Move @babel/polyfill import to webpack config (#26094
Browse files Browse the repository at this point in the history
)" (#26192)

This reverts commit ed6beaa.

[Rationale](#26094 (comment)):

> This PR [increased](http://iscalypsofastyet.com/push/ed6beaa5e0b54f6ddbe11360c8ad8a572b83a32f/e3642614723d88c353e5d768969d8f877d7472c4) the bundle size and [reverted](http://iscalypsofastyet.com/push/acef9fa493cc06a9fefece7ff00759997af8ca8a/03502467b044464e191c9746c510c6a10a7930e0) the improvements achieved in #25961.
>
> It's because `babel-preset-env` used to transform the `@babel/polyfill` import into a list that excludes the polyfills that are not needed on the target browser list. In the new location of `@babel/polyfill`, the plugin doesn't get the opportunity to do that transform and all polyfills are bundled again.

I filed #26094 in the first place to get #24788 to work. Fortunately, @jsnajdr found [another way](#24788 (comment)).
  • Loading branch information
ockham authored Jul 20, 2018
1 parent 184d10c commit 7feab89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions client/boot/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/** @format */
/**
* External dependencies
*/
import '@babel/polyfill';

/**
* Internal dependencies
*/

import localStoragePolyfill from 'lib/local-storage';

localStoragePolyfill();
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const babelLoader = {

const webpackConfig = {
bail: ! isDevelopment,
entry: { build: [ '@babel/polyfill', path.join( __dirname, 'client', 'boot', 'app' ) ] },
entry: { build: [ path.join( __dirname, 'client', 'boot', 'app' ) ] },
profile: shouldEmitStats,
mode: isDevelopment ? 'development' : 'production',
devtool: isDevelopment ? '#eval' : process.env.SOURCEMAP || false, // in production builds you can specify a source-map via env var
Expand Down

0 comments on commit 7feab89

Please sign in to comment.