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 21, 2022
1 parent ee13c99 commit 7d2e9dc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions build/contextHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */

const fs = require('fs');

const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const { getNamedConfiguration } = require('../app/config');

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 +16,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 +43,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 7d2e9dc

Please sign in to comment.