From 1cc3b79c2fe8e6162e24edfa91df9631d224a28e Mon Sep 17 00:00:00 2001 From: Kyle Alwyn Date: Tue, 7 Aug 2018 14:33:40 -0700 Subject: [PATCH] fix: Remove polyfill setting from transform runtime plugin --- package.json | 6 ++++-- src/config/polyfills.js | 4 ++++ src/config/webpack.base.ts | 22 ++++++++++++---------- yarn.lock | 36 ++++++++++++++++++------------------ 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 1d36e67..27e7831 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,10 @@ ], "license": "MIT", "scripts": { + "example": "cd example && yarn start", "test": "jest", "prebuild": "rimraf lib", - "build": "tsc --emitDeclarationOnly && babel src --out-dir lib --copy-files --extensions \".ts\"", + "build": "babel src --out-dir lib --copy-files --extensions \".ts\"", "prepublishOnly": "npm run build", "release": "standard-version" }, @@ -56,6 +57,7 @@ "mini-css-extract-plugin": "0.4.1", "node-sass": "4.9.2", "object-assign": "4.1.1", + "object.values": "^1.0.4", "optimize-css-assets-webpack-plugin": "5.0.0", "postcss-flexbugs-fixes": "3.3.1", "postcss-loader": "2.1.6", @@ -80,7 +82,7 @@ "react-dom": "^16.0.0" }, "devDependencies": { - "@babel/preset-typescript": "^7.0.0-beta.54", + "@babel/preset-typescript": "^7.0.0-beta.53", "@types/autoprefixer": "^6.7.3", "@types/case-sensitive-paths-webpack-plugin": "^2.1.2", "@types/express": "^4.16.0", diff --git a/src/config/polyfills.js b/src/config/polyfills.js index 9c61b85..6748891 100644 --- a/src/config/polyfills.js +++ b/src/config/polyfills.js @@ -13,6 +13,10 @@ require('whatwg-fetch'); // It will use the native implementation if it's present and isn't buggy. Object.assign = require('object-assign'); +if (!Object.values) { + require('object.values').shim(); +} + // In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet. // We don't polyfill it in the browser--this is user's responsibility. if (process.env.NODE_ENV === 'test') { diff --git a/src/config/webpack.base.ts b/src/config/webpack.base.ts index 0a97f06..8455adf 100644 --- a/src/config/webpack.base.ts +++ b/src/config/webpack.base.ts @@ -132,19 +132,22 @@ export default ({ mode, paths, env, sourceMaps }: IWebpackConfig): Configuration use: [ // This loader parallelizes code compilation, it is optional but // improves compile time on larger projects - { - loader: 'thread-loader', - options: { - poolTimeout: Infinity, // keep workers alive for more effective watch mode - }, - }, + // { + // loader: 'thread-loader', + // options: { + // poolTimeout: Infinity, // keep workers alive for more effective watch mode + // }, + // }, { loader: 'babel-loader', options: { presets: [ - ['@babel/preset-env', { useBuiltIns: 'entry', modules: false }], - ['@babel/preset-react', { development: mode === 'development', useBuiltIns: true }], - '@babel/preset-flow' + ['@babel/env', { + useBuiltIns: 'entry', + modules: false, + }], + ['@babel/react', { development: mode === 'development', useBuiltIns: true }], + '@babel/flow' ], plugins: [ ['@babel/plugin-proposal-decorators', { legacy: true }], @@ -155,7 +158,6 @@ export default ({ mode, paths, env, sourceMaps }: IWebpackConfig): Configuration '@babel/plugin-transform-runtime', { helpers: false, - polyfill: false, regenerator: true, }, ], diff --git a/yarn.lock b/yarn.lock index d523a20..ea91cb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -187,14 +187,14 @@ version "7.0.0-beta.53" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.53.tgz#d64458636ffc258b42714a9dd93aeb6f8b8cf3ed" -"@babel/helper-plugin-utils@7.0.0-beta.54": - version "7.0.0-beta.54" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.54.tgz#61d2a9a0f9a3e31838a458debb9eebd7bdd249b4" - "@babel/helper-plugin-utils@7.0.0-beta.55": version "7.0.0-beta.55" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.55.tgz#31f40777efd6b961da8496a923c22d2b062b3f73" +"@babel/helper-plugin-utils@7.0.0-beta.56": + version "7.0.0-beta.56" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0-beta.56.tgz#e5f63cae8b3b716825d64e69ad8b59d71cd2080c" + "@babel/helper-regex@7.0.0-beta.53": version "7.0.0-beta.53" resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.0.0-beta.53.tgz#6e9d2197b562779e225565946ae9a85c215b225e" @@ -394,11 +394,11 @@ dependencies: "@babel/helper-plugin-utils" "7.0.0-beta.53" -"@babel/plugin-syntax-typescript@7.0.0-beta.54": - version "7.0.0-beta.54" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.0.0-beta.54.tgz#7b01ddebccba8f78693bf2898e1f695bb8a76a7e" +"@babel/plugin-syntax-typescript@7.0.0-beta.56": + version "7.0.0-beta.56" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.0.0-beta.56.tgz#836a166feb51f955540f815bf936f99e17a2681e" dependencies: - "@babel/helper-plugin-utils" "7.0.0-beta.54" + "@babel/helper-plugin-utils" "7.0.0-beta.56" "@babel/plugin-transform-arrow-functions@7.0.0-beta.53": version "7.0.0-beta.53" @@ -622,12 +622,12 @@ dependencies: "@babel/helper-plugin-utils" "7.0.0-beta.53" -"@babel/plugin-transform-typescript@7.0.0-beta.54": - version "7.0.0-beta.54" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.0.0-beta.54.tgz#7b614ba0dbea88b70ae82df9c429e128928c9251" +"@babel/plugin-transform-typescript@7.0.0-beta.56": + version "7.0.0-beta.56" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.0.0-beta.56.tgz#1357852a7ef303ca002b6ed7e4712578148edbeb" dependencies: - "@babel/helper-plugin-utils" "7.0.0-beta.54" - "@babel/plugin-syntax-typescript" "7.0.0-beta.54" + "@babel/helper-plugin-utils" "7.0.0-beta.56" + "@babel/plugin-syntax-typescript" "7.0.0-beta.56" "@babel/plugin-transform-unicode-regex@7.0.0-beta.53": version "7.0.0-beta.53" @@ -699,12 +699,12 @@ "@babel/plugin-transform-react-jsx-self" "7.0.0-beta.53" "@babel/plugin-transform-react-jsx-source" "7.0.0-beta.53" -"@babel/preset-typescript@^7.0.0-beta.54": - version "7.0.0-beta.54" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.0.0-beta.54.tgz#7491df7c0f20d08ca63c41f78d2c722c92470391" +"@babel/preset-typescript@^7.0.0-beta.53": + version "7.0.0-beta.56" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.0.0-beta.56.tgz#eff0414072f018014f857c072a07e524088568b0" dependencies: - "@babel/helper-plugin-utils" "7.0.0-beta.54" - "@babel/plugin-transform-typescript" "7.0.0-beta.54" + "@babel/helper-plugin-utils" "7.0.0-beta.56" + "@babel/plugin-transform-typescript" "7.0.0-beta.56" "@babel/register@^7.0.0-beta.53": version "7.0.0-beta.54"