Questions tagged [less-loader]
59 questions
8
votes
0 answers
Antd uses deprecated javascriptEnabled
Antd says here that inline javascript should be enabled in less with the javascriptEnabled: true option. However, this option has been deprecated for Less as of version 3.0.0 due to security concerns as it is vulnerable to code injection, which is…

Jimmy
- 3,090
- 12
- 42
- 99
6
votes
1 answer
webpack.config.js not setting global less variable
Any idea of why this webpack.config.js is not setting the global LESS variable: current-vehicle defined on: /resources/scripts/theme.js?
/webpack.config.js
const merge = require("webpack-merge");
const path = require("path");
const baseConfig =…

Viewsonic
- 827
- 2
- 15
- 34
6
votes
0 answers
Can't modifyVars dynamically in Less / Nuxt.Js
I'm building a web platform using Nuxt.Js and Ant as a front-end framework.
I saw that it is possible to change the theme of Ant using Less and Less-loader. So I did it before the build with the following code :
antd-ui.js
import Vue from…

Nadox56
- 355
- 1
- 2
- 8
6
votes
3 answers
Import global variables in less-loader
In my webpack config, I want to be able to define a global less-variables file which would be included in every less component.
With the sass-loader you can supply the following option:
loaderOptions: {
data: "@import 'globals.sass'"
}
The only…

Rinux
- 815
- 1
- 9
- 18
5
votes
1 answer
Webpack less-loader javascriptEnabled Error
I was getting this error when I moved from less-loader version 6.0.0 to version 6.1.0 when trying to load my Ant Design library into my front-end with Webpack. I wanted to know if anyone else had this issue and resolved it (I answered it…

Jonathon Tech
- 331
- 3
- 7
3
votes
1 answer
Webpack - different font path for build and production css in the less-loader
I'm trying to create an CSS from LESS with webpack. My source folder have following hierarchy:
fonts
desyrel
desyrel_-webfont.woff
less
ds-handwritten.less
Content of less file include relative font path, which will be used in the…

aztechowski
- 113
- 7
3
votes
1 answer
Customizing Ant Design's theme: what exactly is that 'hack' key in the 'modifyVars' option of less-loader?
I've been customizing Ant Design's theme recently for a project, and it's going ok. However, I am intrigued by this approach presented in the docs (https://ant.design/docs/react/customize-theme#Customize-in-webpack):
{
loader: 'less-loader', //…

Mathieu
- 725
- 5
- 19
3
votes
1 answer
Webpack LESS-loader Unexpected character error
i can't compile less files. I don't know where i'm doing mistake.
Can u help me?
Error is:
Failed to compile.
**./src/less/main.less 1:0
Module parse failed: Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file…

user3348410
- 2,733
- 10
- 51
- 85
3
votes
0 answers
Webpack with Less and Source Map - Weird path behaviour
I have been trying to resolve an issue for a long time with Webpack, Less and Code Map - it seems to all show the right information for everything except the styles. The issue is that all Less files are displayed with the full path of project…

xarizmat
- 71
- 6
3
votes
0 answers
css-loader ModuleNotFoundError: Module not found: Error: Can't resolve the file path
Please help me resolve ModuleNotFoundError when i try to import assets to my .less file.
Looks like the issue is will css-loader, can someone help me in gracefully resolving the issue.
Link to issue on git…

Greeen Apple
- 441
- 1
- 4
- 12
2
votes
1 answer
How to load fonts from LESS file with Webpack 5?
I am using Webpack 5 and loading fonts and other styles from a .less file. However, the fonts/styles do not seem to be loading, and I'm trying to figure out why.
bootstrap.less
@import (less) '~bootstrap/dist/css/bootstrap.css';
@font-face {
…

jeanmw
- 446
- 2
- 17
2
votes
2 answers
Error evaluating function `ceil`: argument must be a number
On OSX, after I installed all of dependencies by yarn install, The webpack bundle's output keeps showing the error Error evaluating function ceil: argument must be a number.
I have no idea why this happen but it works on my linux machine with the…

Telvin Nguyen
- 3,569
- 4
- 25
- 39
2
votes
1 answer
Antd Import on Demand get error: Variable @import is undefined by less-loader
I want to config antd Import on Demand.But I get the error: Variable @import is undefined
The error screenshots
Why less parse @import as a variable?
This is my package.json:
"dependencies": {
"@babel/preset-typescript": "^7.16.0",
…

pbgf
- 21
- 3
2
votes
1 answer
How to resolve yarn warnings
I created a new project with the vue cli.
This project is a Vue3 with Ant Design, Vue Router and Eslint.
However when I give the yarn command it shows me the following warnings.
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching…

Abner Matheus
- 41
- 1
- 8
2
votes
2 answers
How to replace the deprecated javascriptEnabled option in less-loader with a new plugin
I need to use inline js for my less files, and previously had a webpack config with something like this to enable inline js:
module.exports = {
...
module: {
...
rules: [
...
{
test: /\.less$/,
use: [
…

Jimmy
- 3,090
- 12
- 42
- 99