Craco TS Loader
This is an adaptation of craco-babel-loader, but for ts-loader.
If you are here, you've followed the use-ts-loader recipe, but things are not working as expected and your craco.config.js imports craco-babel-loader.
NOTE: The text below was adapted from craco-babel-loader
Install
$ yarn add craco-ts-loader
$ npm install craco-ts-loader
$ npm install --save craco-ts-loader
Usage
const path = require("path");
const fs = require("fs");
const rewireTsLoader = require("craco-ts-loader");
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
module.exports = {
plugins: [
{ plugin: rewireTsLoader,
options: {
includes: [resolveApp("node_modules/isemail")],
excludes: [/(node_modules|bower_components)/]
}
}
]
}
Development
Chores
- Lint:
yarn run lint
- Prettier:
yarn run pretty
- Test:
yarn run test
- Pre-publish:
yarn run prepublish
- Build:
yarn run build
License
MIT.