Warning: Value assigned to primitive will be lost for craco config

Viewed 60

The following craco config has been taken as is from multiple articles on the internet that show how to include your monorepo UI library into the CRA build flow:

const path = require('path');
const { getLoader, loaderByName } = require('@craco/craco');

const uiPath = path.join(__dirname, '../../packages/ui');

module.exports = {
    webpack: {
        alias: {},
        plugins: [],
        configure: (webpackConfig, { env, paths }) => {
            const { isFound, match } = getLoader(webpackConfig, loaderByName('babel-loader'));
            if (isFound) {
                const include = Array.isArray(match.loader.include) ? match.loader.include : [match.loader.include];
                match.loader.include = include.concat([uiPath]);
            }
            return webpackConfig;
        },
    },
};

...which works very well, but I don't understand why my IDE keeps showing the warning Value assigned to primitive will be lost for the following line:

match.loader.include = include.concat([uiPath]);

0 Answers
Related