UNPKG

570 BJavaScriptView Raw
1// @flow
2import path from 'path';
3
4import type {Config} from '@parcel/types';
5import type {BabelConfig} from './types';
6
7export default function getTypescriptOptions(
8 config: Config,
9 pragma: ?string,
10 pragmaFrag: ?string,
11): BabelConfig {
12 return {
13 plugins: [
14 [
15 '@babel/plugin-transform-typescript',
16 {
17 isTSX: path.extname(config.searchPath) === '.tsx',
18 // Needed because of https://github.com/babel/babel/issues/12585
19 jsxPragma: pragma,
20 jsxPragmaFrag: pragmaFrag,
21 },
22 ],
23 ],
24 };
25}