5.0.2 • Published 9 months ago
@ts-tools/webpack-loader v5.0.2
@ts-tools/webpack-loader
TypeScript loader for webpack.
Features:
- Fast! Uses
ts.transpileModule
. Leaves type checking to other flows. - Uses persistent disk caching (
node_modules/.cache/ts-<moodule>-<target>
). Second run will not re-transpile a file if not changed. - Loads configuration from the closest
tsconfig.json
. - Automated source map configuration based on current
devtool
configuration.
Getting started
Install the library as a dev dependency in an existing TypeScript project:
npm i @ts-tools/webpack-loader --save-dev
And adjust your webpack configuration to include:
module.exports = {
// ...
module: {
rules: [
{
test: /\.tsx?$/,
loader: '@ts-tools/webpack-loader',
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.mjs', '.js', '.json'],
},
// ...
};
Options
interface ITypeScriptLoaderOptions {
/**
* Keys to override in the `compilerOptions` section of the
* `tsconfig.json` file.
*/
compilerOptions?: object;
/**
* Turn persistent caching on/off.
*
* @default true
*/
cache?: boolean;
/**
* Absolute path of an existing directory to use for persistent cache.
*
* @default uses `find-cache-dir` to search for caching path.
*/
cacheDirectoryPath?: string;
/**
* Path to `tsconfig.json` file.
* Specifying it will skip config lookup
*/
configFilePath?: string;
/**
* Name of config file to search for when looking up config.
*
* @default 'tsconfig.json'
*/
configFileName?: string;
/**
* Should loader search for config.
* Loader will search for the closest tsconfig file to the root context, and load it.
*
* @default true
*/
configLookup?: boolean;
}
Options can be provided via the webpack configuration:
module.exports = {
// ...
module: {
rules: [
{
test: /\.tsx?$/,
loader: '@ts-tools/webpack-loader',
options: {
compilerOptions: {
target: 'es5',
},
},
},
],
},
// ...
};
Similar projects
License
MIT
5.0.2
9 months ago
5.0.1
10 months ago
5.0.0
10 months ago
4.0.0
2 years ago
3.0.2
3 years ago
3.0.1
3 years ago
2.1.1
4 years ago
2.1.0
4 years ago
2.0.1
4 years ago
2.0.0
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.1
4 years ago
1.1.2
4 years ago
1.1.0
5 years ago
1.0.0
5 years ago
0.8.14
5 years ago
0.8.13
5 years ago
0.8.12
5 years ago
0.8.11
5 years ago
0.8.10
5 years ago
0.8.9
5 years ago
0.8.8
5 years ago
0.8.7
5 years ago
0.8.6
5 years ago
0.8.5
5 years ago
0.8.4
5 years ago
0.8.3
5 years ago
0.8.2
5 years ago
0.8.1
5 years ago
0.8.0
5 years ago
0.7.5
5 years ago
0.7.4
5 years ago
0.7.3
5 years ago
0.7.2
5 years ago
0.7.1
6 years ago
0.7.0
6 years ago
0.4.0
6 years ago
0.3.3
6 years ago
0.3.2
6 years ago
0.3.1
6 years ago
0.3.0
6 years ago
0.2.0
6 years ago
0.1.1
6 years ago