Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 10 additions & 36 deletions fec.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,12 @@ class IstanbulCoveragePlugin {

const plugins = [new IstanbulCoveragePlugin()];

function add_define(key, value) {
const definePluginIndex = plugins.findIndex(
(plugin) => plugin instanceof webpack.DefinePlugin,
);
if (definePluginIndex !== -1) {
const definePlugin = plugins[definePluginIndex];

const newDefinePlugin = new webpack.DefinePlugin({
...definePlugin.definitions,
[key]: JSON.stringify(value),
});

plugins[definePluginIndex] = newDefinePlugin;
} else {
plugins.push(
new webpack.DefinePlugin({
[key]: JSON.stringify(value),
}),
);
}
}

if (process.env.NODE_ENV) {
add_define('process.env.NODE_ENV', process.env.NODE_ENV);
plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
);
}

if (process.env.ENABLE_SENTRY) {
Expand Down Expand Up @@ -106,7 +88,7 @@ module.exports = {
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
// we don't wan't these packages bundled with
// we don't want these packages bundled with
// the service frontend, so we can set the aliases
// to false
cockpit: false,
Expand All @@ -119,18 +101,13 @@ module.exports = {
{
// running `make` on cockpit plugin creates './pkg'
// directory, the generated files do not pass
// `npm run build` outputing failures
// this ensures the directory is exluded during build time
exclude: ',/pkg',
// `npm run build` outputting failures
// this ensures the directory is excluded during build time
exclude: path.resolve(__dirname, 'pkg'),
},
],
},
routes: {
...(process.env.CONFIG_PORT && {
[`${process.env.BETA ? '/beta' : ''}/config`]: {
host: `http://localhost:${process.env.CONFIG_PORT}`,
},
}),
...(process.env.LOCAL_IMAGE_BUILDER_API && {
'/api/image-builder': {
host: process.env.LOCAL_IMAGE_BUILDER_API,
Expand All @@ -144,14 +121,11 @@ module.exports = {
return {
...acc,
[`/apps/${appName}`]: { host: `${protocol}://${host}:${appPort}` },
[`/beta/apps/${appName}`]: {
host: `${protocol}://${host}:${appPort}`,
},
};
}, {}),
}),
},
plugins: plugins,
plugins,
moduleFederation: {
exposes: {
'./RootApp': path.resolve(__dirname, './src/AppEntry.tsx'),
Expand Down
Loading