Closed alansouzati closed 9 years ago
Are you trying to use rechoir directly, or via another tool like Liftoff?
Via another tool with Liftoff.
cc @phated
Which tool?
This is unfortunate, but I believe you'll need to use the cli's --require
flag to manually load babel in this instance. Most people who use Liftoff map extensions to loaders using this: https://github.com/tkellen/js-interpret/blob/master/index.js.
I don't see a sane path forward to supporting any arbitrary extensions that can "just work".
Thanks for your fast follow-up on this @tkellen, but, in your opinion, what is the extension of this file testing.tmp.js
? For me, I was expecting that to be .js
. The current way you guys are loading the extensions it treats as tmp.js
(I believe you guys did that because of the .babel.js
convention).
If .js
is the extension of testing.tmp.js
then we don't have any arbitrary extensions. Unless you judge differently, which then I will treat the issue with the other library and verify if they can change to testing-tmp.js
or something like that.
In my opinion, this library has to support this, but I'm probably not very much experienced to argue further.
@tkellen I think we need to check extensions recursively. Let me think about this some more.
Yeah, @phated: the Pull Request that I sent tried to do that in a poor way. The PR is #25.
I've changed the regex a little bit and return, instead of a single extension, an array of possible extensions.
Hopefully this will help you guys to figure out something better than what I did.
@alansouzati Sorry for closing your PR so soon. I think the approach you were taking was very close to what we should do.
If you can re-implement and have the extension checking break on the first match I'd be happy to merge this (with tests)!
No problem @tkellen, I will re-implement. I'm assuming I should send a new PR, right?
Yes please.
I'm getting the same error as well, using liftoffjs after updating. However, I'm getting it with 'rc' and no extension:
const cli = new Liftoff({
name: 'crawler',
extensions: objectAssign({'rc': null}, interpret.jsVariants),
configName: '.crawler',
v8flags: v8flags
});
I tried testing with @alansouzati new PR. I still have the same issue with only a slightly different message:
throw new Error('No module loader found for "'+usedExtension+'".');
^
Error: No module loader found for ".crawlerrc".
I hope this helps. If I use any of the other extensions, it works as expected. But of course, I built it with 'rc' in mind.
Thanks in advance.
@seethroughtrees Please note that all extensions must include the leading dot, i.e. ".rc" instead of just "rc".
@seethroughtrees Crap. That is a regression. We need to add the full filename as the first option in #26.
Thanks @tkellen
This is partially resolved in 0.6.2
. Filenames like dist.configfile.js
or .configfilerc
will work. We still haven't resolved compound extensions like configfile.tmp.js
tho.
@seethroughtrees Can you confirm this is working for .configrc files?
Just got a chance to test. worked great with .configrc... Thanks for the work!
@alansouzati This should be working now. I fixed it in https://github.com/tkellen/js-rechoir/commit/62fb2a62b6102f9ba07a05c7380ce237bb47b349.
cool thanks @tkellen . Just to make sure I understood correctly, the fix is where you add the nothrow
option?
And is nothrow
true by default or I need to provide a configuration for that?
Yeah. This works because you're not using a special module loader (and also fixes the situation with files like .configrc
). What it doesn't address (and I'm not sure that I want to address) is solving compound extensions that require a loader (like .coffee.babel.js
or something).
Gotcha you. Awesome thanks man.
Sure thing! I'm going to dig in using your PR in a min to see if I can fix the rest of this stuff.
I have a scenario where my file name has the following format
filename.tmp.js
.The extension from rechoir is
.tmp.js
where I was expecting that to be.js
.I believe because of that we can't find the corresponding module loader for this file.