KABBOUCHI / laravel-mix-merge-manifest

This extension support multi mix configration without overwriting the mix-manifest.json file
62 stars 6 forks source link

Cannot read properties of undefined (reading 'call') #11

Open mehmetyilmaz001 opened 1 year ago

mehmetyilmaz001 commented 1 year ago

Getting error when split chunks enabled. Is there any examples when split chunks enabled?

image

image

Here is my config

`reactConfigFiles.forEach(function(configFile){
    // process only .bundle.js files
    if ( configFile.indexOf('.bundle.js') > 0 ) {
        // if the buildComponents is empty or configFile is in the list of components to build, let's build it
        // otherwise skip it (helpful for building only one component)
        if ( buildComponents.length === 0 || buildComponents.indexOf(configFile.replace('.bundle.js', '')) > -1 ) {

            const configFilePath = `${__dirname}/resources/configs/react/${configFile}`;
            const config = require(configFilePath);
            hotEntry = config.entry;

            config.resources.forEach(config => {
                console.log('Building: ', config['resourcePath']);
                if(config['resourcePath'] && config['outputPath'] && config['resourcePath'].indexOf('.scss') > 0){
                    mix.sass(config['resourcePath'], config['outputPath']);
                }else{
                    mix.js(config['resourcePath'], config['outputPath']).react().mergeManifest;
                }
            });
        }
    }
});`
`mix.webpackConfig({
    output: {
        ...mix.options.output,
        chunkFilename: 'js/react/chunks/[name].js?v=[chunkhash]'
    },
    experiments: {
        outputModule: true,
    },
    optimization: {
        ...mix.options.optimization,
        mergeDuplicateChunks: true,
        usedExports: true,
        concatenateModules: true,
        flagIncludedChunks: true,
        sideEffects: true,
    },
    devServer: {
        hot: true,
        open: [hotEntry],
        compress: false,
        static: {
            directory: path.join(__dirname, 'public'),
        },
        webSocketServer: 'ws',
        proxy: {
            context: () => true,
            target: 'http://localhost',
        },
        client: {
            logging: 'info',
            progress: true,
        }
    }
});`

`mix.extract([
    "react",
    "react-dom",
    "lodash", 
    "moment",
    "moment-timezone",
    "react-bootstrap", 
    "redux-form", 
    "graphql", 
    "apollo/client", 
    "@material-ui", 
    "@material-ui/core", 
    "mui-datatables",
    "@bugsnag/js"
], 'js/react/vendor.js').mergeManifest();`