Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
awesome-typescript-loader
Advanced tools
npm install awesome-typescript-loader --save-dev
ts-loader
awesome-typescript-loader
loader was created mostly to speed-up compilation in my own projects.
Some of them are quite big and I wanted to have full control on how my files are compiled. There are three major points:
atl has first-class integration with Babel and enables caching possibilities. This can be useful for those who use Typescript with Babel.
When useBabel
and useCache
flags are enabled, typescript's emit will be transpiled with Babel and cached.
So next time if source file (+environment) has the same checksum we can totally skip typescript's and babel's transpiling.
This significantly reduces build time in this scenario.
atl is able to fork type-checker and emitter to a separate process, which also speeds-up some development scenarios (e.g. react with react-hot-loader) So your webpack compilation will end earlier and you can explore compiled version in your browser while your files are typechecked.
.ts
as a resolvable extension..ts
extension to be handled by awesome-typescript-loader
.webpack.config.js
// `CheckerPlugin` is optional. Use it if you want async error reporting.
// We need this plugin to detect a `--watch` mode. It may be removed later
// after https://github.com/webpack/webpack/issues/3460 will be resolved.
const { CheckerPlugin } = require('awesome-typescript-loader')
module.exports = {
// Currently we need to add '.ts' to the resolve.extensions array.
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
// Source maps support ('inline-source-map' also works)
devtool: 'source-map',
// Add the loader for .ts files.
module: {
loaders: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader'
}
]
},
plugins: [
new CheckerPlugin()
]
};
After that, you will be able to build TypeScript files with webpack.
The loader supports NodeJS 4 and newer.
You can use the tsconfig.json file to configure your compiler and loader:
{
"compilerOptions": {
"noImplicitAny": true,
"removeComments": true
},
"awesomeTypescriptLoaderOptions": {
/* ... */
}
}
awesome-typescript-loader@2.x
aims to support only typescript@2.x
and webpack@2x
, if you need old compilers please use
1.x
or 0.x
versions.
If you want to use new paths
and baseUrl
feature of TS 2.0 please include TsConfigPathsPlugin
.
This feature is available only for webpack@2.1
.
var TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin;
resolve: {
plugins: [
new TsConfigPathsPlugin(/* { tsconfig, compiler } */)
]
}
No logging from the checker. Please note that this option disables async error reporting because
this option bans console.log()
usage.
Allows use of TypeScript compilers other than the official one. Must be set to the NPM name of the compiler, e.g. ntypescript or the path to a package folder. Note that the compiler must be installed in your project. You can also use nightly versions.
Use fast transpileModule
emit mode. Disables automatically when you set compilerOption declaration: true
(reference).
Allows the use of several TypeScript compilers with different settings in one app. Override instance
to initialize another instance.
Specifies the path to a TS config file. This is useful when you have multiple config files. This setting is useless inside a TS config file.
Use this setting to disable type checking.
You can squelch certain TypeScript errors by specifying an array of diagnostic codes to ignore.
For example, you can transpile stage 1 properties from *.js
using "ignoreDiagnostics": [8014]
.
Invoke Babel to transpile files. Useful with ES6 target. Please see useCache
option
which can improve warm-up time.
Override the path used to find babel-core
. Useful if node_modules
is installed in a non-standard place or webpack is being invoked from a directory not at the root of the project.
Use this option to pass some options to Babel (e.g. presets). Please note that
.babelrc
file is more universal way to do this.
Use internal file cache. This is useful with Babel, when processing takes a long time to complete. Improves warm-up time.
Use pre-compiled files if any. Files must be named as {filename}.js
and {filename}.map
.
Directory when cache is stored.
You can pass compiler options inside loader query string or in tsconfig file.
3.0.4-rc.2 (2017-02-11)
<a name="3.0.4-rc.1"></a>
FAQs
Awesome TS loader for webpack
The npm package awesome-typescript-loader receives a total of 92,158 weekly downloads. As such, awesome-typescript-loader popularity was classified as popular.
We found that awesome-typescript-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.