-
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
Browserify can't resolve "./tree/n" modules #1818
Comments
We want to switch to use browserify to create our browser release.. but.. |
I'm doing a self-contained application which should be isomorphic at some point, some APIs would run on the browser, NodeJS and JVM. Actually using LESS for quick editing and preview on browser, and it should compile at server-side too, producing the same results. Since all the related code is making |
okay but this approach will only work if you don't have imports and don't use anything like the data-uri function... regardless of whether it will work, I am happy making the change above and later refactoring it to be nicer. If you do a pull request I'll just merge it. |
BTW; i'm confident about import/data-uri issues, but actually i'm not using such features. It's sure that making less = require('less')
less.imports['mixins'] = '''
.btcf() {
&:after {
content: '';
display: table;
clear: both;
}
}
''' Then, we can still using Lets imagine that you exports any LESS file this way, now you're able to compile in a self-contained manner. |
thanks merged |
Good day. stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: ENOENT, open 'tls' while resolving "tls" from file <project>/node_modules/less/node_modules/request/node_modules/forever-agent/index.js
at <project>/node_modules/browserify/node_modules/module-deps/index.js:152:29
at fs.js:207:20
at Object.oncomplete (fs.js:107:15) I presume that is because browserify obviously doesn't have browser-shim for |
Having a script (inside the less-repo) like this: var less = require('./lib/less'),
parser = new less.Parser,
output;
parser.parse('body{color:red}', function(e, tree) {
output = tree.toCSS();
});
console.log(output); I fixed that ignoring some modules: browserify -e main.js -o bundle.js -i fs -i url -i path -i mime -i events -i request -i clean-css -i source-map --no-detect-globals Executing both scripts will produce the same results: node main.js
node bundle.js |
@lukeapage Would #1732 address this? If less core was not Node-specific, I would assume it wouldn't conflict with a Browserify environment. |
@pateketrueke, thanks for the tip. I've ignored tls and less loaded successfully. |
@matthew-dean yes it would address it - I would like to use browserify to generate a concatted environment agnostic single file |
I'm working on a project that requires LESS to be included using Browserify.
The main issue here is about how LESS is including its own modules internally.
Actually Browserify won't understand any dynamic require-calls, so the results are frustrating at this point.
Switching that loop with its static-version shall produce nice results.
These require-calls are fully understandable by Browserify.
What do you think?
The text was updated successfully, but these errors were encountered: