Skip to content

Commit

Permalink
fix: rollback typescript plugin to avoid babel config conflicts (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Edelman authored and jaredpalmer committed Oct 29, 2019
1 parent 9c10c70 commit 3989277
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 251 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@types/shelljs": "^0.8.5",
"@typescript-eslint/eslint-plugin": "^2.3.1",
"@typescript-eslint/parser": "^2.3.1",
"@wessberg/rollup-plugin-ts": "^1.1.70",
"ansi-escapes": "^4.2.1",
"asyncro": "^3.0.0",
"babel-eslint": "^10.0.3",
Expand Down Expand Up @@ -88,6 +87,7 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-typescript2": "^0.24.3",
"sade": "^1.4.2",
"shelljs": "^0.8.3",
"tiny-glob": "^0.2.6",
Expand Down
32 changes: 15 additions & 17 deletions src/createRollupConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import json from 'rollup-plugin-json';
import replace from 'rollup-plugin-replace';
import resolve from 'rollup-plugin-node-resolve';
import sourceMaps from 'rollup-plugin-sourcemaps';
import ts from '@wessberg/rollup-plugin-ts';
import { ScriptTarget, JsxEmit } from 'typescript';
import path from 'path';
import typescript from 'rollup-plugin-typescript2';
import { extractErrors } from './errors/extractErrors';
import { babelPluginTsdx } from './babelPluginTsdx';
import { TsdxOptions } from './types';
Expand Down Expand Up @@ -128,22 +126,22 @@ export function createRollupConfig(opts: TsdxOptions) {
};
},
},
ts({
hook: {
outputPath: (fp, kind) => {
if (/declaration/.test(kind) && opts.format === 'esm') {
return path.join(path.dirname(fp), 'index.d.ts');
}
typescript({
typescript: require('typescript'),
cacheRoot: `./.rts2_cache_${opts.format}`,
tsconfig: opts.tsconfig,
tsconfigDefaults: {
compilerOptions: {
sourceMap: true,
declaration: true,
jsx: 'react',
},
},
tsconfigOverride: {
compilerOptions: {
target: 'esnext',
},
},
tsconfig: tsconfig => ({
...tsconfig,
target: ScriptTarget.ESNext,
sourceMap: true,
declaration: opts.format === 'esm',
jsx: JsxEmit.React,
}),
transpiler: 'babel',
}),
babelPluginTsdx({
exclude: 'node_modules/**',
Expand Down
Loading

0 comments on commit 3989277

Please sign in to comment.