kibana/tsconfig.json
Spencer 06b1af33ab
[build/ts] transpile public code with webpack-specific ts config (#21865)
Right now the build process is running TypeScript code through a single transpilation process which produces the JS code that ships with the distributable. This process causes problems because when running the optimizer from source we use a slightly different config 33c6ade756/src/optimize/base_optimizer.js (L312-L313), which instructs typescript to build modules using ESM, which webpack understands, but in the build we transpile this TypeScript to commonjs, which does not support features that are important to the strategy we are using to maintain BWC with the legacy platform as we migrate to the new platform.

This implements a `tsconfig.browser.json` file at the root of the repository that extends the default `tsconfig.json` file and includes a `src/**/public/**/*` code, which the root `tsconfig.json` file now excludes. This new config file is added to the list of projects that we lint, is shared with webpack, and is built along with the default project in the build process to create JS code that uses esm for webpack to consume.
2018-08-10 13:55:41 -07:00

55 lines
1.7 KiB
JSON

{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"ui/*": ["src/ui/public/*"]
},
// Support .tsx files and transform JSX into calls to React.createElement
"jsx": "react",
// Enables all strict type checking options.
"strict": true,
// enables "core language features"
"lib": [
// ESNext auto includes previous versions all the way back to es5
"esnext",
// includes support for browser APIs
"dom"
],
// Node 8 should support everything output by esnext, we override this
// in webpack with loader-level compiler options
"target": "esnext",
// Use commonjs for node, overridden in webpack to keep import statements
// to maintain support for things like `await import()`
"module": "commonjs",
// Allows default imports from modules with no default export. This does not affect code emit, just type checking.
// We have to enable this option explicitly since `esModuleInterop` doesn't enable it automatically when ES2015 or
// ESNext module format is used.
"allowSyntheticDefaultImports": true,
// Emits __importStar and __importDefault helpers for runtime babel ecosystem compatibility.
"esModuleInterop": true,
// Resolve modules in the same way as Node.js. Aka make `require` works the
// same in TypeScript as it does in Node.js.
"moduleResolution": "node",
// Disallow inconsistently-cased references to the same file.
"forceConsistentCasingInFileNames": true,
// Disable the breaking keyof behaviour introduced in TS 2.9.2 until EUI is updated to support that too
"keyofStringsOnly": true
},
"include": [
"src/**/*"
],
"exclude": [
"src/**/__fixtures__/**/*",
"src/**/public/**/*"
]
}