Skip to content

Commit

Permalink
webpack setup: refactor, fix broken sprites import
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Sep 7, 2022
1 parent 886a1e4 commit 35688af
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions build/contextHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */

const fs = require('fs');
const { getNamedConfiguration } = require('../app/config');

const FaviconsWebpackPlugin = require('favicons-webpack-plugin');

function getAllConfigs() {
if (process.env.CONFIG && process.env.CONFIG !== '') {
return [require('../app/config').getNamedConfiguration(process.env.CONFIG)];
return [getNamedConfiguration(process.env.CONFIG)];
}

const srcDirectory = './app/configurations';
Expand All @@ -16,7 +17,7 @@ function getAllConfigs() {
.filter(file => /^config\.\w+\.js$/.test(file))
.map(file => {
const theme = file.replace('config.', '').replace('.js', '');
return require('../app/config').getNamedConfiguration(theme);
return getNamedConfiguration(theme);
});
}

Expand All @@ -43,12 +44,11 @@ function getEntries(theme, sprites) {

function getAllThemeEntries() {
if (process.env.CONFIG && process.env.CONFIG !== '') {
const config = require('../app/config').getNamedConfiguration(
process.env.CONFIG,
);
const defaultConfig = getNamedConfiguration('default');
const config = getNamedConfiguration(process.env.CONFIG);

return {
...getEntries('default'),
...getEntries('default', defaultConfig.sprites),
...getEntries(process.env.CONFIG, config.sprites),
};
}
Expand Down

0 comments on commit 35688af

Please sign in to comment.