From 79aeb8affbfc85e2d1efd31a4ff68f965b79b212 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 23 Dec 2021 14:06:19 +0100 Subject: [PATCH] do not transform rquire context when not in test mode --- admin/babel.config.js | 17 ++++++++++++++--- admin/src/i18n.js | 4 +--- admin/src/locales/de.json | 4 ++-- admin/src/locales/en.json | 6 +++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/admin/babel.config.js b/admin/babel.config.js index 80b148fd1..742388ea3 100644 --- a/admin/babel.config.js +++ b/admin/babel.config.js @@ -1,4 +1,15 @@ -module.exports = { - presets: ['@babel/preset-env'], - plugins: ['transform-require-context'], +module.exports = function (api) { + api.cache(true) + + const presets = ['@babel/preset-env'] + const plugins = [] + + if (process.env.NODE_ENV === 'test') { + plugins.push('transform-require-context') + } + + return { + presets, + plugins, + } } diff --git a/admin/src/i18n.js b/admin/src/i18n.js index b72734d1f..14e81543e 100644 --- a/admin/src/i18n.js +++ b/admin/src/i18n.js @@ -4,11 +4,9 @@ import VueI18n from 'vue-i18n' Vue.use(VueI18n) const loadLocaleMessages = () => { - const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i) - console.log(locales) + const locales = require.context('./locales/', true, /[A-Za-z0-9-_,\s]+\.json$/i) const messages = {} locales.keys().forEach((key) => { - console.log(key) const matched = key.match(/([A-Za-z0-9-_]+)\./i) if (matched && matched.length > 1) { const locale = matched[1] diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 72d5f685a..96a409c60 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -1,4 +1,4 @@ { - "open_creations":"offene Schöpfungen", - "not_open_creations":"keine offene Schöpfungen" + "not_open_creations": "keine offene Schöpfungen", + "open_creations": "offene Schöpfungen" } diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index bbde7b043..20ab609e0 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -1,4 +1,4 @@ { - "open_creations":"open creations", - "not_open_creations":"not open creations" -} \ No newline at end of file + "not_open_creations": "No open creations", + "open_creations": "Open creations" +}