Skip to content

Commit 9e46944

Browse files
authored
ref(build): Switch tsconfig target to es6 (#5005)
This switches our default tsonfig `target` value from `es5` to `es6`. (Though we'll soon not be using `tsc` for transpilation, our tsconfig still matters for things like tests, because ts-jest uses it.) Note: Doing this required adding a temporary workaround to get node 8 tests to pass. Once we switch to sucrase builds (which don't have the same problem), it will come out.
1 parent 69028bf commit 9e46944

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/typescript/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"sourceMap": true,
2424
"strict": true,
2525
"strictBindCallApply": false,
26-
"target": "es5"
26+
"target": "es6"
2727
}
2828
}

scripts/test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { spawnSync } from 'child_process';
2+
import * as fs from 'fs';
23
import { join } from 'path';
34

45
function run(cmd: string, cwd: string = '') {
@@ -37,6 +38,7 @@ if (nodeMajorVersion <= 10) {
3738
'@sentry/gatsby',
3839
'@sentry/serverless',
3940
'@sentry/nextjs',
41+
'@sentry/angular',
4042
];
4143

4244
// This is a hack, to deal the fact that the browser-based tests fail under Node 8, because of a conflict buried
@@ -46,6 +48,12 @@ if (nodeMajorVersion <= 10) {
4648
// against a single version of node, but in the short run, this at least allows us to not be blocked by the
4749
// failures.)
4850
run('rm -rf packages/tracing/test/browser');
51+
52+
// TODO Pull this out once we switch to sucrase builds
53+
// Recompile as es5, so as not to have to fix a compatibility problem that will soon be moot
54+
const baseTSConfig = 'packages/typescript/tsconfig.json';
55+
fs.writeFileSync(baseTSConfig, String(fs.readFileSync(baseTSConfig)).replace('"target": "es6"', '"target": "es5"'));
56+
run(`yarn build:dev ${ignorePackages.map(dep => `--ignore="${dep}"`).join(' ')}`);
4957
}
5058
// Node 10
5159
else {

0 commit comments

Comments
 (0)