The webpack handwritten loader introduces error: Module not found: Error: path argument is not a string

Custom loaders cannot be imported in a way similar to the following

const myLessLoader = require('./loader/my-less-loader');

It needs to be introduced and used in the following ways



Rules configuration code

module: {
        rules: [
                test: /\.(ts|tsx)$/i,
                use: ['ts-loader'],
                exclude: ['/node_modules/'],
                test: /\.less$/i,
                use: [stylesHandler, 'css-loader', 'postcss-loader', 'less-loader', path.resolve('./loader/my-less-loader.js')],

Similar Posts: