Comments (26)
I was getting the same error when I had two loaders for less in webpack.config
from less-loader.
有**人吗 怎么弄
from less-loader.
有**人吗 怎么弄
pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。
from less-loader.
I have exactly the same error. @maheshiv did you solve it? If yes, could you share the solution?
from less-loader.
same
from less-loader.
same here
from less-loader.
I also have this error.
This problem has been resolved after removing an another loader setting.
from less-loader.
I was getting the same error when I had two loaders for less in webpack.config
Yep, that's also the case here as you can see in the console output 😁
from less-loader.
same here
` error in ./~/bootstrap/less/bootstrap.less
Module build failed:
// load the styles
var content = require("!!../../css-loader/index.js?{"minimize":false,"sourceMap":false}!../../less-loader/dist/cjs.js?{"sourceMap":false}!./bootstrap.less");
^
Unrecognised input
in D:\web\vue\iot\node_modules\bootstrap\less\bootstrap.less (line 4, column 12)
@ ./~/bootstrap/less/bootstrap.less 4:14-207 18:2-22:4 19:20-213
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
error in ./~/style-loader/lib/addStyles.js
Module build failed: Error: ENOENT: no such file or directory, open 'D:\web\vue\iot\node_modules\style-loader\lib\addStyles.js'
at Error (native)
@ ./~/bootstrap/less/bootstrap.less 12:13-60
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
`
from less-loader.
how to resolve?
from less-loader.
from less-loader.
have you solved it?
from less-loader.
@holidaying 把你的less文件发上来看看
from less-loader.
same
from less-loader.
What f* for this error, It does not show anything about how to resolve or debug with it, So f* foolish.
from less-loader.
some happen to me today, i am so confused, how to solve
from less-loader.
If this is happens due to your file matching two different match clauses, you can resolve it by either making patterns mutually exclusive, or by changing the extension of the .less
file and having second pattern match against it. It's not the prettiest solution, though.
from less-loader.
有**人吗 怎么弄
pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。
是的,我就是删除webpack.base.conf 里的{
test: /.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader', // translates CSS into CommonJS
},
{
loader: 'less-loader', // compiles Less to CSS
options: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
}
},
}]
}
修改build/utils 里的less: generateLoaders('less', { javascriptEnabled: true })
解决的。
from less-loader.
有**人吗 怎么弄
pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。是的,我就是删除webpack.base.conf 里的{
test: /.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader', // translates CSS into CommonJS
},
{
loader: 'less-loader', // compiles Less to CSS
options: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
}
},
}]
}
修改build/utils 里的less: generateLoaders('less', { javascriptEnabled: true })
解决的。
确实可行。但.less文件里面不能写style标签,更没有scoped这样的命名空间了。会不会到时候样式串掉
from less-loader.
有**人吗 怎么弄
pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。是的,我就是删除webpack.base.conf 里的{
test: /.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader', // translates CSS into CommonJS
},
{
loader: 'less-loader', // compiles Less to CSS
options: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
}
},
}]
}
修改build/utils 里的less: generateLoaders('less', { javascriptEnabled: true })
解决的。确实可行。但.less文件里面不能写style标签,更没有scoped这样的命名空间了。会不会到时候样式串掉
没有遇到你说的这个问题,这个是覆盖某个库文件的 modifyVars 变量而已
from less-loader.
哎。不得不说,以前自己配置webpack的时候 坑相对还少一些,虽然辛苦是辛苦了一点,但都是一个一个loader配置进去的,虽然不怎么健壮。自从用了cli后,发现遇到问题除了google来git上找问题,基本很难自己发现。坑也很难察觉。
from less-loader.
有**人吗 怎么弄
pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。是的,我就是删除webpack.base.conf 里的{
test: /.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader', // translates CSS into CommonJS
},
{
loader: 'less-loader', // compiles Less to CSS
options: {
modifyVars: {
'primary-color': '#1DA57A',
'link-color': '#1DA57A',
'border-radius-base': '2px',
}
},
}]
}
修改build/utils 里的less: generateLoaders('less', { javascriptEnabled: true })
解决的。确实可行。但.less文件里面不能写style标签,更没有scoped这样的命名空间了。会不会到时候样式串掉
没有遇到你说的这个问题,这个是覆盖某个库文件的 modifyVars 变量而已
我也出现,没法在less文件写style标签,就没法写scope这样的变量空间。
from less-loader.
有**人吗 怎么弄
并没有找到build/utils文件在哪儿,但是我把需要添加的那段代码放在webpack.config.js的oneOf中不会报错。
// webpack.config.js
module.exports = {
...
module: {
...
rules: [
...
{
oneOf:[
{
test: /\.less$/,
use: [{
loader: 'style-loader',
}, {
loader: 'css-loader', // translates CSS into CommonJS
}, {
loader: 'less-loader', // compiles Less to CSS
}]
},
...
]
}
};
from less-loader.
This is most likely caused by having duplicate rules defined which are handling .less
files twice.
If you have some LESS files which are loaded using the use()
method, the convention is to name them as styleName.useable.less
Be sure to exclude *.useable.less
from the "default" less
handler to avoid this error:
let rules = [
{
test: /\.useable\.less$/,
use:
[
{
loader: "style-loader/useable"
}
]
},
{
test: /\.less$/,
exclude:
/\.useable\.less$/,
use:
[
{
loader: 'style-loader'
}
]
}
]
from less-loader.
mark
from less-loader.
same, @pterolex 正解!
from less-loader.
Related Issues (20)
- TypeError: this.getOptions is not a function HOT 1
- less object is empty in CRA project HOT 1
- Variable @z-index not found HOT 1
- TypeError: this.getPosition is not a function HOT 1
- less loader ignore the files out side the 'root' (where webpack.config.js live in) HOT 1
- webpack less-loader css modules fail HOT 5
- Slow build of file with too many imports HOT 3
- @apply detects as variable HOT 1
- ng test error with PhantomJS , getting less error HOT 1
- facing less error in angular 12 HOT 6
- this.getOptions is not a function HOT 1
- not find prependData and apendData information in README.md HOT 1
- Confusing `imports` explanation HOT 2
- Error: Module build failed
- Quieter logging HOT 2
- Attempt to track cache dependencies for synchronous loaded resources HOT 1
- less-loader not working with webpack-dev-server hmr HOT 8
- Invalid dependencies when webpack alias same with workspace folder HOT 5
- Compilation fails if CSS variable is last property of selector HOT 2
- `@import ` cannot recursively look up the npm package directory HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from less-loader.