From e04e3ffd89a458131eb5f262392adcae91e08a07 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Fri, 18 Mar 2022 00:20:42 +0000 Subject: [PATCH] Single babel config --- app/frontend/application.js | 8 ++++---- babel.config.js | 12 ++++++++++++ package.json | 10 +--------- yarn.lock | 5 +++++ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/frontend/application.js b/app/frontend/application.js index 164ac5541..6fe3925ee 100644 --- a/app/frontend/application.js +++ b/app/frontend/application.js @@ -2,17 +2,17 @@ // present in this directory. You're encouraged to place your actual application logic in // a relevant structure within app/javascript and only use these pack files to reference // that code so it'll be compiled. -require.context("govuk-frontend/govuk/assets") // Polyfills for IE -import "core-js/features/promise" -import "unfetch/polyfill" +import "regenerator-runtime/runtime" import "@stimulus/polyfills" +import "custom-event-polyfill" // +require.context("govuk-frontend/govuk/assets") +import { initAll } from "govuk-frontend" import "./styles/application.scss" import "./controllers" import "@hotwired/turbo-rails" -import { initAll } from "govuk-frontend" initAll() diff --git a/babel.config.js b/babel.config.js index e90be956c..b07829909 100644 --- a/babel.config.js +++ b/babel.config.js @@ -41,6 +41,18 @@ module.exports = function(api) { loose: true } ], + [ + "@babel/plugin-proposal-private-methods", + { + loose: true + } + ], + [ + "@babel/plugin-proposal-private-property-in-object", + { + loose: true + } + ], [ '@babel/plugin-proposal-object-rest-spread', { diff --git a/package.json b/package.json index bc96c722b..a19697feb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "copy-webpack-plugin": "^10.2.4", "core-js": "^3.21.1", "css-loader": "^6.7.1", + "custom-event-polyfill": "^1.0.7", "file-loader": "^6.2.0", "govuk-frontend": "^4.0.1", "mini-css-extract-plugin": "^2.6.0", @@ -46,15 +47,6 @@ "last 1 safari version" ] }, - "babel": { - "presets": [ - "@babel/preset-env" - ], - "plugins": [ - "@babel/plugin-proposal-class-properties", - "@babel/plugin-proposal-private-methods" - ] - }, "scripts": { "build": "webpack --config webpack.config.js" } diff --git a/yarn.lock b/yarn.lock index 479f7f2a7..664ef0ba7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1519,6 +1519,11 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== +custom-event-polyfill@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/custom-event-polyfill/-/custom-event-polyfill-1.0.7.tgz#9bc993ddda937c1a30ccd335614c6c58c4f87aee" + integrity sha512-TDDkd5DkaZxZFM8p+1I3yAlvM3rSr1wbrOliG4yJiwinMZN8z/iGL7BTlDkrJcYTmgUSb4ywVCc3ZaUtOtC76w== + date-fns@>=2.0.0: version "2.28.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.28.0.tgz#9570d656f5fc13143e50c975a3b6bbeb46cd08b2"