cardero-x-razzle-plugin-typescript
v2.5.0
Published
Use TypeScript with Razzle
Downloads
4
Readme
razzle-plugin-typescript
This package contains a plugin for using TypeScript with Razzle
Usage in Razzle Projects
yarn add razzle-plugin-typescript
Using the plugin with the default options
// razzle.config.js
module.exports = {
plugins: ['typescript'],
};
With custom options:
// razzle.config.js
module.exports = {
plugins: [
{
name: 'typescript',
options: {
useBabel: false,
useEslint: true, // ignored if `useBabel` is false
tsLoader: {
transpileOnly: true,
experimentalWatchApi: true,
},
forkTsChecker: {
tsconfig: './tsconfig.json',
tslint: './tslint.json',
watch: './src',
typeCheck: true,
},
},
},
],
};
Options
useBabel: boolean (defaults: false)
Set useBabel
to true
if you want to keep using babel
for JS/TS interoperability, or if you want to apply any babel transforms to typescript files. (i.e.: babel-plugin-styled-components
).
useEslint: boolean (defaults: true)
Note: This option is ignored if useBabel
is set to false
.
Set useEslint
to false
if you want to use babel
for transforms but do not wish to use eslint.
tsLoader: TSLoaderOptions (defaults: { transpileOnly: true, experimentalWatchApi: true })
Use this to override ts-loader
options. Check all the options here: ts-loader options.
forkTsChecker: TSCheckerOptions (defaults: { tsconfig: './tsconfig.json', tslint: './tslint.json', watch: './src', typeCheck: true })
Use this to override fork-ts-checker-webpack-plugin
options. Check all the options here: fork-ts-checker-webpack-plugin options.