diff --git a/frontend/babel.config.js b/frontend/babel.config.js index 5907ab074..fab7b82b8 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -1,11 +1,22 @@ -module.exports = { - presets: ['@babel/preset-env'], - plugins: [ +module.exports = function (api) { + api.cache(true) + + const presets = ['@babel/preset-env'] + const plugins = [ [ 'component', { styleLibraryName: 'theme-chalk', }, ], - ], + ] + + if (process.env.NODE_ENV === 'test') { + plugins.push('transform-require-context') + } + + return { + presets, + plugins, + } } diff --git a/frontend/package.json b/frontend/package.json index 5fbdcb0d8..cfa7be87c 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -23,7 +23,6 @@ "axios": "^0.21.1", "babel-core": "^7.0.0-bridge.0", "babel-jest": "^27.3.1", - "babel-plugin-require-context-hook": "^1.0.0", "babel-preset-vue": "^2.0.2", "bootstrap": "4.3.1", "bootstrap-vue": "^2.5.0", @@ -89,6 +88,7 @@ "@vue/eslint-config-prettier": "^4.0.1", "babel-eslint": "^10.1.0", "babel-plugin-component": "^1.1.0", + "babel-plugin-transform-require-context": "^0.1.1", "dotenv-webpack": "^7.0.3", "node-sass": "^6.0.1", "sass-loader": "^10", diff --git a/frontend/yarn.lock b/frontend/yarn.lock index d1d6eacd0..2bc1361be 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1217,7 +1217,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.12.13", "@babel/template@^7.16.0", "@babel/template@^7.3.3": +"@babel/template@7", "@babel/template@^7.12.13", "@babel/template@^7.16.0", "@babel/template@^7.3.3": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.0.tgz#d16a35ebf4cd74e202083356fab21dd89363ddd6" integrity sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A== @@ -3325,11 +3325,6 @@ babel-plugin-polyfill-regenerator@^0.1.2: dependencies: "@babel/helper-define-polyfill-provider" "^0.1.2" -babel-plugin-require-context-hook@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-require-context-hook/-/babel-plugin-require-context-hook-1.0.0.tgz#3f0e7cce87c338f53639b948632fd4e73834632d" - integrity sha512-EMZD1563QUqLhzrqcThk759RhuNVX/ZJdrtGK6drwzgvnR+ARjWyXIHPbu+tUNaMGtPz/gQeAM2M6VUw2UiUeA== - babel-plugin-syntax-jsx@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" @@ -3345,6 +3340,13 @@ babel-plugin-transform-es2015-modules-commonjs@^6.26.0, babel-plugin-transform-e babel-template "^6.26.0" babel-types "^6.26.0" +babel-plugin-transform-require-context@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-require-context/-/babel-plugin-transform-require-context-0.1.1.tgz#319b545ca83080b5062776b46cc9b8b346fea9a6" + integrity sha512-4ceqYOtzgmq4/QsB8dP7pUrUOCjY/jrRYdt7YkIOWHxtGDQbcf6YZDyLCiPQf6KsEIcIbSQiTRXOsbLiuJfgNQ== + dependencies: + "@babel/template" "7" + babel-plugin-transform-strict-mode@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758"