shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.4k stars 123 forks source link

[Error] Invalid left-hand side expression in prefix operation #242

Closed DaveyJake closed 3 years ago

DaveyJake commented 3 years ago

After two days of trying to debug this, I'm hoping someone here can help?

Initially, I thought it was due to still using Webpack 4 as other devDependencies are using Webpack 5. After running npm install webpack@latest --save-dev, I find I'm still getting this error.

Unsure of what to do, I adjusted my config to only handle the JS. All of the SCSS and images are handled separately and are working fine.

My current webpack.config.js is as follows:

import path from 'path';
import ESLintWebpackPlugin from 'eslint-webpack-plugin';

module.exports = {
    mode: 'development',
    devtool: 'source-map',
    target: 'web',
    context: path.resolve( __dirname, '.' ),
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(^_*$|node_modules(?![\\\/]foundation-sites))/,
                use: ['babel-loader']
            }
        ]
    },
    plugins: [
        new ESLintWebpackPlugin({ eslintPath: path.resolve( __dirname, '.eslintrc.yml' ) })
    ],
    optimization: {
        emitOnErrors: true
    },
    resolve: {
        alias: {
            Helpers: path.resolve( __dirname, '/path/to/src/js/helpers/' ),
            Modules: path.resolve( __dirname, '/path/to/src/js/modules/' ),
            UI: path.resolve( __dirname, '/path/to/src/js/ui/' ),
            Vendor: path.resolve( __dirname, '/path/to/src/js/_vendor/' )
        }
    },
    entry: {
        app: path.resolve( __dirname, '/path/to/entry.js' )
    },
    output: {
        path: path.resolve( __dirname, '/path/to/dist/js' ),
        publicPath: `/wp-content/plugins/${ path.basename( __dirname ) }/dist/js/`,
        filename: '[name].min.js',
        devtoolNamespace: path.basename( __dirname )
    },
    externals: {
        jQuery: 'jQuery',
        lodash: {
            commonjs: 'lodash',
            amd: 'lodash',
            root: '_'
        },
        google: 'google',
        MarkerClusterer: 'MarkerClusterer',
    },
    stats: 'verbose'
}

Does anyone have any ideas of why I continue to get the Invalid left-hand side expression in prefix operation error? Any advice would be much appreciated.

shama commented 3 years ago

This is an issue board for reporting issues with webpack-stream. I recommend stackoverflow.com or webpack's support channels for more general help.

DaveyJake commented 3 years ago

This is an issue board for reporting issues with webpack-stream. I recommend stackoverflow.com or webpack's support channels for more general help.

My CLI says, Error in plugin "webpack-stream"

DaveyJake commented 3 years ago

@shama

Screen Shot 2021-09-03 at 16 17 16
shama commented 3 years ago

You'll need to provide a lot more information about how this issue originates from this library webpack-stream. A stack trace is a good start.

I'm fairly certain the error is occurring from somewhere else while using this library though. Especially considering this library isn't a plugin and I'm not familiar with any of the code you provide above.