spatie / laravel-mix-purgecss

Zero-config Purgecss for Laravel Mix
https://spatie.be/en/opensource
MIT License
874 stars 38 forks source link

TypeError: Cannot read property 'webpackConfig' of undefined #127

Closed MKM421 closed 2 years ago

MKM421 commented 2 years ago

Hi, just upgraded a project to laravel-mix 6 and I'm getting an error based on my webpack.mix.js configuration.

node v14.16.0 npm v8.3.0

My webpack.mix.js: `const { mix } = require('laravel-mix'); const path = require('path');

const includePaths = [ path.resolve(dirname, 'app/assets/scss'), path.resolve(dirname, 'node_modules/breakpoint-sass/stylesheets'), path.resolve(dirname, 'node_modules/font-awesome/scss'), path.resolve(__dirname, 'node_modules/singularitygs/stylesheets'), path.resolve(dirname, 'node_modules/select2/dist/css'), ];

mix.webpackConfig({ module: { rules: [ { enforce: 'pre', test: /.scss?$/, loader: 'import-glob-loader', exclude: /(node_modules)/, }, { test: /.hbs$/, loader: 'handlebars-template-loader', } ], }, });

mix.options({ publicPath: 'app/webroot/', processCssUrls: false, uglify: { sourceMap: false, }, });

mix.js('app/assets/js/client/app.js', 'assets/js/client/app.js') .extract([ 'backbone', 'backbone.marionette', 'backbone.radio', 'jquery', 'moment', 'node-polyglot', 'underscore', 'react', 'react-dom', 'validator', ], 'assets/js/client/vendor.js')

.copy('node_modules/datatables.net-jqui/css/dataTables.jqueryui.css', 'app/webroot/vendors/jquery-datatables/css/demo_table_jui.css')

.js('app/assets/js/client/queue.js', 'assets/js/client/queue.js') .js('app/assets/js/admin/staff.js', 'assets/js/admin/staff.js') .js('app/assets/js/admin/queue.js', 'assets/js/admin/queue.js') .js('app/assets/js/admin/staff-password-validator.js', 'assets/js/admin/staff-password-validator.js') .js('app/assets/js/admin/vendor-password-validator.js', 'assets/js/admin/vendor-password-validator.js')

.react('laravel/resources/assets/js/client/feedback.js', 'assets/js/client/feedback.js') .sass('app/assets/scss/client.scss', 'assets/css/client.css', { includePaths }) .sass('app/webroot/scss/client-view-informative.scss', 'css') .sass('app/webroot/scss/client-view-wrapper.scss', 'css') .sass('app/webroot/scss/cake.generic.scss', 'css') .sass('app/webroot/scss/global.scss', 'css') .sass('app/webroot/scss/reports_pdf.scss', 'css') .sass('app/webroot/scss/reports_printable.scss', 'css') .sass('app/webroot/scss/rogers.scss', 'css') .sass('app/webroot/scss/rogersunison.scss', 'css') .sass('app/webroot/scss/pages/service_categories.scss', 'css'); `