-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Remove "browser" from package.json to fix Browserify #2696
base: master
Are you sure you want to change the base?
Conversation
I tested this and can confirm browserify problem, it throws slightly different error on 2.5.3 through. The reason is that less.js in dist directory was already browserified in grunt.js. Browserify can not run twice over the same code, because the meaning of
When you run browserify again on the same code, it must fail. Already browserified code is located in different directory then original file and filesystem does not contain If we want to have |
The other pull request suggests that user should use the |
For a more brute-force solution to the |
We could also link minimized version, that does not have require function. However, that feels hacky to me. |
@nolanlawson Having the same issue, but removing |
You don't need to Browserify Less, so I don't get this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Because of |
@seven-phases-max AFAIK, the point of Browserify is to take a JavaScript module designed for Node.js, and package it for the browser.
That's somewhat fair if that's the reason, but I think that's approaching the problem from the wrong direction. That is, while I understand Less.js's historical implementation of generating HTML/CSS on errors automatically on browsers, and automatically parsing stylesheets, I don't think there's any need for that in modern web development. Less should be included as a script, and then an API call should be made to actually grab stylesheets from the page and convert/inject them as CSS. That would be how it would be done today. So, if the problem is: "I need a browser-based version of Less," that exists. If the problem is: "I need a browser-based version of Less that doesn't do X," then this is the wrong approach. Re-reading though, it seems like the problem is that Less is being bundled by Browserify as part of someone's build process, a problem which we somewhat created by adding a "browser" property? 🤔
@SomMeri Does this PR fix that? I don't know enough about the underlying ecosystem (Browserify) to know if this puts duct tape over the problem or solves it correctly. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I tried to follow the discussion from #2525, but wasn't really understanding why this was added in the first place.
Using Browserify 11.1.0, it's impossible to use less @2.5.1 as part of your build. I can reproduce it as easily as:
You'll see the error:
This commit fixes that.