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
path.resolve('./loader/my-less-loader.js')
Attached:
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:
- Webpack high version pulls out CSS style and reports an error [Solved]
- Invalid configuration object. Webpack has been initialised using a..
- [Solved] configuration.module has an unknown property ‘loader’
- Solutions to the problem that image webpack loader cannot be installed or the installation is stuck
- Cannot findmodule’webpack-cli/bin/config-yargs
- Solve Error: MissingSchemaError: Schema hasn’t been registered for model “YourModel”.
- Module build failed: Error: Cannot find module ‘node-sass’
- Error in xxx.js from uglifyjs after elementui upgrade [How to Solve]
- [Solved] [email protected] Error: Cannot find module ‘webpack/bin/config-yargs‘
- export ‘default’ (imported as ‘mod’) was not found in ‘-!../../../../node_module .vue?vue&type=script&lang=ts&’ (possible exports: __esModule)