Skip to content

Commit

Permalink
Update webpack environment targets (#4649)
Browse files Browse the repository at this point in the history
Also:
* Bump browserslist
* Widen browser support matrix
* Update browser typescript target to ES2018
* Bump `autoprefixer` but remove its usage as it spams the logs about it being unnecessary

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki authored Aug 3, 2023
1 parent bf6e887 commit e867585
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 35 deletions.
15 changes: 10 additions & 5 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[production]
last 2 Firefox versions
last 2 Chrome versions
last 2 Safari versions
> 0.25%
not ie 11
Firefox > 0 and last 2 years and > 0.01%
Chrome > 0 and last 2 years and > 0.01%
Safari > 0 and last 2 years and > 0.01%
Edge > 0 and last 1 years and > 0.01%
Opera > 0 and last 2 years and > 0.01%
> 0.2%
not op_mini all
not and_uc < 100
not android < 100
not dead

[dev]
last 1 chrome versions
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Removes `minimatch` manual resolution ([#3019](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3019))
- Upgrade `vega-lite` dependency from `4.17.0` to `^5.6.0` ([#3076](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3076)). Backwards-compatible version included in v2.5.0 release.
- Bump `js-yaml` from `3.14.0` to `4.1.0` ([#3770](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3770))
- Update webpack environment targets ([#4649](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4649))

### 🪛 Refactoring

Expand Down
2 changes: 1 addition & 1 deletion packages/osd-babel-preset/node_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = (_, options = {}) => {
// `nvm install 8 && node ./src/cli` will run OpenSearch Dashboards
// in node version 8 and babel will stop transpiling async/await
// because they are supported in the "current" version of node
node: 'current',
node: 14,
},

// replaces `import "core-js/stable"` with a list of require statements
Expand Down
4 changes: 4 additions & 0 deletions packages/osd-babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-styled-components": "^2.0.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"browserslist": "^4.21.10",
"react-is": "^16.8.0",
"styled-components": "^5.3.9"
},
"devDependencies": {
"@types/browserslist": "^4.15.0"
}
}
5 changes: 5 additions & 0 deletions packages/osd-babel-preset/webpack_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
* under the License.
*/

const { resolve } = require('path');
const browserlist = require('browserslist');
const targets = browserlist.loadConfig({ path: resolve(__dirname, '../..') });

module.exports = () => {
return {
presets: [
Expand All @@ -36,6 +40,7 @@ module.exports = () => {
{
useBuiltIns: 'entry',
modules: false,
targets,
// Please read the explanation for this
// in node_preset.js
corejs: '3.2.1',
Expand Down
4 changes: 3 additions & 1 deletion packages/osd-optimizer/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@
*/

module.exports = {
plugins: [require('autoprefixer')()],
plugins: [
/*require('autoprefixer')()*/
],
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "es5",
"target": "es2018",
"module": "esnext",
},
"include": [
Expand Down
Loading

0 comments on commit e867585

Please sign in to comment.