diff --git a/package.json b/package.json index 7a8596da9d377..a623b656ec9a1 100644 --- a/package.json +++ b/package.json @@ -163,7 +163,6 @@ "compare-versions": "3.5.1", "core-js": "^3.2.1", "css-loader": "2.1.1", - "custom-event-polyfill": "^0.3.0", "d3": "3.5.17", "d3-cloud": "1.2.5", "deep-freeze-strict": "^1.1.1", diff --git a/packages/kbn-ui-shared-deps/entry.js b/packages/kbn-ui-shared-deps/entry.js index 250abd162f91d..7a15c3bb742c0 100644 --- a/packages/kbn-ui-shared-deps/entry.js +++ b/packages/kbn-ui-shared-deps/entry.js @@ -17,6 +17,9 @@ * under the License. */ +// import global polyfills before everything else +require('./polyfills'); + // must load before angular export const Jquery = require('jquery'); window.$ = window.jQuery = Jquery; diff --git a/packages/kbn-ui-shared-deps/package.json b/packages/kbn-ui-shared-deps/package.json index 2e62eb3504aca..c9434f3ec1c38 100644 --- a/packages/kbn-ui-shared-deps/package.json +++ b/packages/kbn-ui-shared-deps/package.json @@ -13,8 +13,11 @@ "@elastic/charts": "^16.1.0", "@kbn/dev-utils": "1.0.0", "@yarnpkg/lockfile": "^1.1.0", + "abortcontroller-polyfill": "^1.3.0", "angular": "^1.7.9", + "core-js": "^3.2.1", "css-loader": "^2.1.1", + "custom-event-polyfill": "^0.3.0", "del": "^5.1.0", "jquery": "^3.4.1", "mini-css-extract-plugin": "0.8.0", @@ -24,6 +27,9 @@ "react-intl": "^2.8.0", "react": "^16.12.0", "read-pkg": "^5.2.0", - "webpack": "4.41.0" + "regenerator-runtime": "^0.13.3", + "symbol-observable": "^1.2.0", + "webpack": "4.41.0", + "whatwg-fetch": "^3.0.0" } } \ No newline at end of file diff --git a/packages/kbn-ui-shared-deps/polyfills.js b/packages/kbn-ui-shared-deps/polyfills.js new file mode 100644 index 0000000000000..d2305d643e4d2 --- /dev/null +++ b/packages/kbn-ui-shared-deps/polyfills.js @@ -0,0 +1,26 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +require('core-js/stable'); +require('regenerator-runtime/runtime'); +require('custom-event-polyfill'); +require('whatwg-fetch'); +require('abortcontroller-polyfill/dist/polyfill-patch-fetch'); +require('./vendor/childnode_remove_polyfill'); +require('symbol-observable'); diff --git a/webpackShims/childnode-remove-polyfill.js b/packages/kbn-ui-shared-deps/vendor/childnode_remove_polyfill.js similarity index 68% rename from webpackShims/childnode-remove-polyfill.js rename to packages/kbn-ui-shared-deps/vendor/childnode_remove_polyfill.js index 26c21d1674b07..d8818fe809ccb 100644 --- a/webpackShims/childnode-remove-polyfill.js +++ b/packages/kbn-ui-shared-deps/vendor/childnode_remove_polyfill.js @@ -1,21 +1,4 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +/* eslint-disable @kbn/eslint/require-license-header */ /* @notice * This product bundles childnode-remove which is available under a diff --git a/src/legacy/core_plugins/tests_bundle/tests_entry_template.js b/src/legacy/core_plugins/tests_bundle/tests_entry_template.js index 02b1f5fec9c19..2f8a2264530d5 100644 --- a/src/legacy/core_plugins/tests_bundle/tests_entry_template.js +++ b/src/legacy/core_plugins/tests_bundle/tests_entry_template.js @@ -29,16 +29,7 @@ export const createTestEntryTemplate = defaultUiSettings => bundle => ` * */ -// import global polyfills before everything else -import 'core-js/stable'; -import 'regenerator-runtime/runtime'; -import 'custom-event-polyfill'; -import 'whatwg-fetch'; -import 'abortcontroller-polyfill'; -import 'childnode-remove-polyfill'; import fetchMock from 'fetch-mock/es5/client'; -import Symbol_observable from 'symbol-observable'; - import { CoreSystem } from '__kibanaCore__'; // Fake uiCapabilities returned to Core in browser tests diff --git a/src/legacy/ui/ui_bundles/app_entry_template.js b/src/legacy/ui/ui_bundles/app_entry_template.js index f0ca97f473324..a1c3a153a196c 100644 --- a/src/legacy/ui/ui_bundles/app_entry_template.js +++ b/src/legacy/ui/ui_bundles/app_entry_template.js @@ -28,14 +28,6 @@ export const appEntryTemplate = bundle => ` * context: ${bundle.getContext()} */ -// import global polyfills -import Symbol_observable from 'symbol-observable'; -import 'core-js/stable'; -import 'regenerator-runtime/runtime'; -import 'custom-event-polyfill'; -import 'whatwg-fetch'; -import 'abortcontroller-polyfill'; -import 'childnode-remove-polyfill'; ${apmImport()} import { i18n } from '@kbn/i18n'; import { CoreSystem } from '__kibanaCore__'