1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix(cli/lsp): fix using jsx/tsx when not emitting via tsc (#9407)

Closes #9308
Closes #9023
Closes #8993
This commit is contained in:
Kitson Kelly 2021-02-05 22:01:48 +11:00 committed by GitHub
parent 923214c537
commit 5b9376908a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

View file

@ -431,8 +431,10 @@ impl Inner {
let mark = self.performance.mark("update_tsconfig"); let mark = self.performance.mark("update_tsconfig");
let mut tsconfig = TsConfig::new(json!({ let mut tsconfig = TsConfig::new(json!({
"allowJs": true, "allowJs": true,
"esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "react",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"module": "esnext", "module": "esnext",
"noEmit": true, "noEmit": true,

View file

@ -799,6 +799,7 @@ impl Graph {
// Enabled by default to align to transpile/swc defaults // Enabled by default to align to transpile/swc defaults
"experimentalDecorators": true, "experimentalDecorators": true,
"incremental": true, "incremental": true,
"jsx": "react",
"isolatedModules": true, "isolatedModules": true,
"lib": options.lib, "lib": options.lib,
"module": "esnext", "module": "esnext",
@ -811,7 +812,6 @@ impl Graph {
// TODO(@kitsonk) consider enabling this by default // TODO(@kitsonk) consider enabling this by default
// see: https://github.com/denoland/deno/issues/7732 // see: https://github.com/denoland/deno/issues/7732
"emitDecoratorMetadata": false, "emitDecoratorMetadata": false,
"jsx": "react",
"inlineSourceMap": true, "inlineSourceMap": true,
"outDir": "deno://", "outDir": "deno://",
"removeComments": true, "removeComments": true,

10
cli/tests/bundle_jsx.out Normal file
View file

@ -0,0 +1,10 @@
[WILDCARD]
const React = {
createElement () {
}
};
function app() {
return React.createElement("div", null, React.createElement("h2", null, "asdf"));
}
console.log(app);

View file

@ -2702,6 +2702,11 @@ console.log("finish");
output: "bundle.test.out", output: "bundle.test.out",
}); });
itest!(bundle_jsx {
args: "bundle jsx_import_from_ts.ts",
output: "bundle_jsx.out",
});
itest!(fmt_check_tests_dir { itest!(fmt_check_tests_dir {
args: "fmt --check ./", args: "fmt --check ./",
output: "fmt/expected_fmt_check_tests_dir.out", output: "fmt/expected_fmt_check_tests_dir.out",