fix for tsx annoyance
jeremy-coleman opened this issue · 1 comments
jeremy-coleman commented
any better solution than this?lol
var gulp = require('gulp');
var replace = require('gulp-batch-replace');
var rename = require('gulp-rename')
let t1 = "= preact"
let t2 = "namespace preact"
let r1 = "= React"
let r2 = "namespace React"
var replacements = [
[ t1, r1 ],
[ t2, r2]
]
gulp.task('setup', () => {
return gulp.src('node_modules/preact/src/preact.d.ts')
.pipe(replace(replacements))
.pipe(rename('index.d.ts'))
.pipe(gulp.dest('node_modules/@types/react'))
});
azizhk commented
One more method can be to add aliases in your tsconfig.json
{
"compilerOptions": {
"paths": {
"react": ["preact-compact"],
"react-dom": ["preact-compact"]
}
}
}
You would have to alias the same in your build tools as well. (Webpack etc.)