mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
Fix issues with JavaScript importing JavaScript. (#4120)
Fixes #3852 Fixes #4117
This commit is contained in:
parent
22f88b9f37
commit
805992b14a
7 changed files with 20 additions and 5 deletions
|
@ -47,18 +47,18 @@ export const defaultBundlerOptions: ts.CompilerOptions = {
|
||||||
|
|
||||||
/** Default options used by the compiler Host when compiling. */
|
/** Default options used by the compiler Host when compiling. */
|
||||||
export const defaultCompileOptions: ts.CompilerOptions = {
|
export const defaultCompileOptions: ts.CompilerOptions = {
|
||||||
allowJs: true,
|
allowJs: false,
|
||||||
allowNonTsExtensions: true,
|
allowNonTsExtensions: true,
|
||||||
strict: true,
|
|
||||||
checkJs: false,
|
checkJs: false,
|
||||||
esModuleInterop: true,
|
esModuleInterop: true,
|
||||||
|
jsx: ts.JsxEmit.React,
|
||||||
module: ts.ModuleKind.ESNext,
|
module: ts.ModuleKind.ESNext,
|
||||||
outDir: OUT_DIR,
|
outDir: OUT_DIR,
|
||||||
resolveJsonModule: true,
|
resolveJsonModule: true,
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
|
strict: true,
|
||||||
stripComments: true,
|
stripComments: true,
|
||||||
target: ts.ScriptTarget.ESNext,
|
target: ts.ScriptTarget.ESNext
|
||||||
jsx: ts.JsxEmit.React
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Options that need to be used when doing a runtime (non bundled) compilation */
|
/** Options that need to be used when doing a runtime (non bundled) compilation */
|
||||||
|
|
|
@ -304,7 +304,11 @@ export const ignoredDiagnostics = [
|
||||||
// support JSON imports. Allegedly this was fixed in
|
// support JSON imports. Allegedly this was fixed in
|
||||||
// Microsoft/TypeScript#26825 but that doesn't seem to be working here,
|
// Microsoft/TypeScript#26825 but that doesn't seem to be working here,
|
||||||
// so we will ignore complaints about this compiler setting.
|
// so we will ignore complaints about this compiler setting.
|
||||||
5070
|
5070,
|
||||||
|
// TS7016: Could not find a declaration file for module '...'. '...'
|
||||||
|
// implicitly has an 'any' type. This is due to `allowJs` being off by
|
||||||
|
// default but importing of a JavaScript module.
|
||||||
|
7016
|
||||||
];
|
];
|
||||||
|
|
||||||
/** When doing a host configuration, processing the response and logging out
|
/** When doing a host configuration, processing the response and logging out
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
"checkJs": true
|
"checkJs": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
cli/tests/fix_js_import_js.ts
Normal file
3
cli/tests/fix_js_import_js.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import { isMod4 } from "./subdir/mod6.js";
|
||||||
|
|
||||||
|
console.log(isMod4);
|
1
cli/tests/fix_js_import_js.ts.out
Normal file
1
cli/tests/fix_js_import_js.ts.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
true
|
|
@ -1160,6 +1160,11 @@ itest!(cafile_info {
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itest!(fix_js_import_js {
|
||||||
|
args: "run --reload fix_js_import_js.ts",
|
||||||
|
output: "fix_js_import_js.ts.out",
|
||||||
|
});
|
||||||
|
|
||||||
itest!(fix_js_imports {
|
itest!(fix_js_imports {
|
||||||
args: "run --reload fix_js_imports.ts",
|
args: "run --reload fix_js_imports.ts",
|
||||||
output: "fix_js_imports.ts.out",
|
output: "fix_js_imports.ts.out",
|
||||||
|
|
1
cli/tests/subdir/mod6.js
Normal file
1
cli/tests/subdir/mod6.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export { isMod4 } from "./mod4.js";
|
Loading…
Add table
Add a link
Reference in a new issue