-
Notifications
You must be signed in to change notification settings - Fork 147
Cannot override config files when used programmatically #501
Comments
Hi @novemberborn! Thanks for the heads up. This is kind-of by design, but I think we can work on it. When passing options programmatically to In this case though, this is an entry script so it would seem reasonable that you'd want your options provided to the loader to at least apply to the entry script itself (regardless of subsequent module loads from the entry). ({default: fileConf = MISSING_DEFAULT_EXPORT} = esm(module, {
cjs: false,
mode: 'all'
})(path.join(projectDir, 'ava.config.js'))); |
Yes that sounds correct, and is what I had assumed the behavior would be. Perhaps an |
I'll try to make this just-work without adding extra config. My current plan is to use the programmatic options as the defaults for all non-entry scripts (current behavior), but use them as an override for the entry script. |
That would be a breaking change, no? |
In the gradient scale of changes I think this would primarily effect folks in AVA's boat. So a test, bundle, or other util that uses Update: Thinking on this more. This would fundamentally change how Note: Hi @cantremember 👋, Node core and Node Module WG member here (me). The |
@jdalton that's a pity. I'm not sure we can use Config loading also happens early enough that we don't have a way for users to indicate they want to use Is your concern that any imports of the Given that we're using the programmatic API, is there any hook where we can use |
I think going down the |
Thanks! How would that impact imports from the file itself? |
For that loader instance I would simply disable resolving Update: I have this working locally. Bikeshed option names? I currently have Update: I went with |
@novemberborn thank you for bringing this issue over into @jdalton i completely understand -- '.mjs' is experimental. it just happens to be the most practical way to identify that a particular script is ESM-flavored. it makes a lot of sense for an evolving adoption process. i deeply appreciate that a project like i could have (a) turned off 💯 |
@jdalton great! This works insofar as that AVA can load |
See avajs/ava#1820 (comment). The user has a project with both AVA (
@next
) andesm
installed. Ifpackage.json
includes{"esm": {mode: "strict"}}
then AVA fails to load theava.config.js
file.AVA sets the mode to
"all"
when instantiatingesm
, but it seems like thepackage.json
configuration still overrides the mode? Reproduced with v3.0.69.The text was updated successfully, but these errors were encountered: