Make CommonJS the default (and some default "exclude" values).#7016
Conversation
| else { | ||
| // by default exclude node_modules, and any specificied output directory | ||
| exclude = ["node_modules"] | ||
| let outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; |
There was a problem hiding this comment.
yes and linter will complaint about it
fix falling tests and linter issues
| "category": "Error", | ||
| "code": 1147 | ||
| }, | ||
| "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": { |
There was a problem hiding this comment.
We have added this message in the past to catch iadvertant use of export/import in the top level of a script file. ppl used to do this by mistak, and spend hours to understand what is wrong with thier program.
@zhengbli and I talked about this, and the conclusion was to leave a valid module target --m none which will trigger this error. this way users who are sure they never need a module loader can set it and get the nice error instead of having to go crazy figuring out what it means.
There was a problem hiding this comment.
Well that's a pain :-/ ModuleKind.None is 0, so I'll need to change all the existing checks that just looks for a falsy value as meaning "not set". Will look into it...
|
Also note, we need to make a similar change on the project property pages in VS (2013 and 2015) |
|
A few changes:
|
|
👍 |
1 similar comment
|
👍 |
Make CommonJS the default (and some default "exclude" values).
This is to address #6807 and make CommonJS the default module type if not specified. Note that this changed a lot of baselines - and mostly for the better. (We had a ton of tests that were valid except for the
must specify a module typeerror. So now these have.typesand.symbolbaselines, instead of just.errorfiles).This change also adds a default
node_modulesand whatever the currentoutDirvalue is (if any) to theexcludearray if there is no value provides in the config file.Note: Two tests are still failing in the LSHost tests. I'm not sure exactly what these are testing of how to fix them (tried a couple of ways unsuccessfully). @vladima do you know what's going on here? The two failing tests are: