webpack-contrib / css-loader

CSS Loader
MIT License
4.3k stars 602 forks source link

TypeError: this.getOptions is not a function #1325

Closed aleBiagini closed 3 years ago

aleBiagini commented 3 years ago

Expected Behavior

I integrated webpack-stream and css-loader inside my gulpfile, proceeded to npm install fullcalendar. I expected to have everything working.

Response from cli

Unhandled rejection Error in plugin "webpack-stream" Message:

    ./node_modules/@fullcalendar/common/main.css
Module build failed (from ./node_modules/style-loader/dist/cjs.js):
TypeError: this.getOptions is not a function
    at Object.loader (C:\Projects\bergamoscienza-umbraco\BergamoScienza.Web\node_modules\style-loader\dist\index.js:19:24)
 @ ./node_modules/@fullcalendar/common/main.js 6:0-20
 @ ./node_modules/@fullcalendar/core/main.js

Gulpfile extract

    `.pipe(webpack(require('./webpack.config.js')))`

webpack.config.js

module.exports = {
    module: {
        rules: [
            {
                test: /\.css$/i,
                use: ["style-loader", "css-loader"],
            },
        ],
    },
};

The code having trouble is from the latest version of fullcalendar.

How Do We Reproduce?

alexander-akait commented 3 years ago

You need webpack v5 to use v5 of css-loader, webpack-stream uses webpack v4 (https://github.com/shama/webpack-stream/blob/master/package.json#L39), please update webpack and webpack-stream