prophet icon indicating copy to clipboard operation
prophet copied to clipboard

Webpack 5+ vendors files are not uploaded by Prophet due to ignore list

Open fleps opened this issue 2 years ago • 3 comments

Describe the bug Prophet has on it's default ignore list the string "node_modules", which is now causing any vendor files compiled by Webpack 5+ to not be uploaded, as Webpack 5+ changed the naming format for vendors JS's and added "node_modules" string on the file name (I know, stupid, source: https://webpack.js.org/guides/code-splitting/

A quick fix I've been doing is basically to edit the Prophet Ignore list on the settings.json and changing from "node_modules" to "node_modules/", but I think that should be fixed on the extension level.

fleps avatar Jun 29 '22 14:06 fleps

@fleps thanks for reporting. I'll take a look

SqrTT avatar Jun 29 '22 14:06 SqrTT

Hi @fleps, I had the same problem and I've been able to workaround it using webpack:

function normalizeName(name) {
    return name.replace(/node_modules/g, "nodemodules").replace(/[\-_.|]+/g, " ")
        .replace(/\b(nodemodules|js|modules|es)\b/g, "")
        .trim().replace(/ +/g, "-");
}

const webpackConfig = {
    // ... other configs
    output: {
        path: `${__dirname}/cartridges/_name_of_our_custom_cartridge_/cartridge/static/default/js`,
        filename: '[name].js',
        chunkFilename: function (pathData) {
            const name = pathData.chunk.name || pathData.chunk.id;

            if (!name.includes('node_modules')) {
                return '[name].js';
            }

            return `${normalizeName(name)}.js`;
        },
        sourceMapFilename: '[file].map',
    }
}

gaarlos avatar Jun 30 '22 09:06 gaarlos

hi @fleps This should be fixed in 1.4.30

SqrTT avatar Aug 01 '22 08:08 SqrTT

hi @fleps This should be fixed in 1.4.30

Still happening in 1.4.31 .

m-iordache avatar Nov 15 '22 13:11 m-iordache

Hey @SqrTT

The issue still occurs on v1.4.31

I changed the ignore list from node_modules -> node_modules/ as a temp fix.

reejojoseph avatar Mar 02 '23 11:03 reejojoseph