-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to config less options #907
Comments
Just moved the description from the seperate comment into the issue body... |
lessrc no working |
@chenshuai2144 Please open a separate issue @vdfor We don’t support inline JavaScript yet |
I think it should be able to turn on this function in lessrc |
less3.0.1 no working,but less2.7.3 is working |
Encountered same problem, all you have to do is add --js flag to lessc command: lessc --js foo.less > bar.css |
@schtr4jh Thank you very much :) you saved me! |
@y-takey I landed here because of some other issue, unrelated to parcel. As far as I know this is something that's changed in some of latest versions of lessc compiler. Maybe you can downgrade lessc if it's installed globally? Or prepare pr that fixes it. :P |
@schtr4jh Thanks for the quick response! I'll try to downgrade lessc. |
What about adding: {
"inlineJavaScript": true
} to .lessrc? According to the less docs this should re-enable the deprecated inlining feature. |
@DeMoorJasper Thanks for the advice! (and sorry for the delay) I've tried it, but i can't work well :(
yes, I agree too. |
Is this fixed? I've been trying to use Antd's babel-plugin-import with Parcel, but doesn't seems to be helpful |
I've managed to make it work using almost the same config than the one in the example available here : https://github.com/ant-design/parcel-antd I've setup HMR so in my case, I needed to have the following
|
The problem is primarily with Less v3. I downgraded it and it worked. but it still requires fixing as we won't be able to stay v2.7 forever |
parcel-bundler/parcel#907 This fixes the examples...
Having the same problem, have to stay on 2.7.3 for now. Hopefully this will be fixed soon. |
As this is a deprecated feature of less, I don't think parcel should fix this. If anyone could open a decent issue with an example repo and such someone might have a look at it. Gonna close this for now. I don't even think less even supports this at all anymore, the inlineJavascript flag seems to have been removed from the config |
It would be nice if there was a flag that enabled this since there are still a ton of libs out there that have inline js. Antd for instance "should" upgrade but I'm having to downgrade to use their lib. It might be too soon to completely ditch it but it's an edge case that should be supported. |
Solution for webpack example:
|
seems .lessrc take no effect |
Why issue is closed? The problem still exists |
v3 still does not work in 2019. Is using version 2.7.1 really the only work around? |
I have fixed this problem just changing before
after
PS: I dont't know if this fix will break something later, but it works for now 👍 |
I got works correctly! my environment:
{
"javascriptEnabled": true
} NOT "inlineJavaScript"
@import "~antd/dist/antd.less";
@primary-color: #4caf50; |
It workded for me too, thanks~ |
Same here. It works! |
This solution worked for me |
@y-takey your solutions doesn't work for me. I tried below setup and it works for me. But I don't know if this is correct way, because I want to use the options package.json "devDependencies": {
"@babel/core": "^7.7.2",
"babel-plugin-import": "^1.12.2",
"less": "^3.10.3",
"parcel-bundler": "^1.12.4"
},
"dependencies": {
"antd": "^3.25.1",
"react": "^16.11.0",
"react-dom": "^16.11.0"
} .babelrc {
"plugins": [
[
"import",
{
"libraryName": "antd"
},
"antd"
]
]
} .lessrc {
"javascriptEnabled": true
} public/index.less @import "../node_modules/antd/dist/antd.less";
@primary-color: purple; |
I came back from the future for another project, and parcel-bundler is still not fixed. The only thing works with parcel is the one plugin I created above #907 (comment). @davidnagli @DeMoorJasper, maybe we should re-open this issue and fix this asap. Because lots of new people are starting to use ant-design with parcel and getting a roadblock with less mostly because parcel does not read the less configuration. It's a parcel issue. I vote to re-open this. |
I tried the setup in #907 (comment) and it seemed to build successfully. Could someone post an updated example and what the expected behaviour is? |
Has anyone found a solution I still can't use less ^3? |
@entrptaher 's solution above, while totally a hack, works awesome for me. This is what I do in a lot of projects, now. I think the asset-loader should probably read the .lessrc, and also maybe just have a default that enables |
So, #4475 fixes the issue! This allows for Antd etc. to be used: package.json: {
"name": "parcel-ant",
"devDependencies": {
"@parcel/transformer-less": "^2.0.0-alpha.3",
"less": "^3.11.1",
"parcel": "2.0.0-nightly.225"
},
"dependencies": {
"antd": "^4.1.3",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"scripts": {
"start": "parcel index.html"
}
} .lessrc: {
"javascriptEnabled": true
} index.less: @import "antd/dist/antd.less";
@primary-color: purple; App.js import React from "react"
import { DatePicker } from "antd"
import "./index.less"
export default (props) => <DatePicker {...props} /> This is the result: Works as expected! |
Thanks alot |
Still getting this error for Parcel 2. |
same
Same here, please can anyone help |
I still have the same problem too. |
This issue is still exist in the latest parcel. I workaround by hard code to the
|
Guess, Antd and Parcel are simply not compatible. |
When using less3, how to enable inline javaScript?
The text was updated successfully, but these errors were encountered: