node-sass: Render with custom import hangs
Given the following fs.readFile
never executes itβs callback and process hang indefinitely.
// entry.scss
@import "_partial";
// _partial.scss
foo{}
var fs = require('fs');
var sass = require('node-sass');
var files = [
'entry.scss',
'entry.scss',
'entry.scss',
'entry.scss',
];
files.forEach(function (file) {
sass.render({
file: file,
importer: function (uri, prev, done) {
var filename = process.cwd() + '/' + uri;
console.log('fs.readFile:', filename);
fs.readFile(filename, function(err, data) {
console.log('I am never executed');
done({ contents: data });
});
}
}, function(err, result) {
console.log('successfully rendered');
});
});
Outputs this and hangs
β node-sass-test node index.js
fs.readFile: /Users/michael/node-sass-test/_partial.scss
fs.readFile: /Users/michael/node-sass-test/_partial.scss
fs.readFile: /Users/michael/node-sass-test/_partial.scss
fs.readFile: /Users/michael/node-sass-test/_partial.scss
This example works fine if:
- I only have 3 files
- I use
renderSync
- I use
fs.readFileSync
This is potentially related to https://github.com/sass/node-sass/issues/794.
This issue has been reproduced on multiple OSX machines on the latest node 0.10, 0.12 and iojs with node-sass@3.0.0-beta.5
About this issue
- Original URL
- State: open
- Created 9 years ago
- Comments: 38 (26 by maintainers)
Commits related to this issue
- Implement queue for node-sass render https://github.com/webpack-contrib/sass-loader/issues/99 https://github.com/webpack-contrib/sass-loader/issues/100 https://github.com/sass/node-sass/issues/857 ht... — committed to mcmar/sass-values-loader by deleted user 7 years ago
- add node version to package.json reverted the node-sass version due to https://github.com/sass/node-sass/issues/857 — committed to mw866/chat-client by mw866 3 years ago
I think I have it identified. Workaround:
env UV_THREADPOOL_SIZE=5 node indes.js
π