Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-loader

Package Overview
Dependencies
Maintainers
3
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-loader

TypeScript loader for webpack

  • 9.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.5M
increased by3.82%
Maintainers
3
Weekly downloads
 
Created

What is ts-loader?

The ts-loader package is a TypeScript loader for webpack that allows you to transpile TypeScript files (.ts, .tsx) to JavaScript while bundling with webpack. It enables you to integrate TypeScript into your webpack build process.

What are ts-loader's main functionalities?

Transpilation of TypeScript to JavaScript

This feature allows you to compile TypeScript files into JavaScript, enabling you to use TypeScript in your webpack projects. The code sample shows a webpack configuration that uses ts-loader to process files with .ts or .tsx extensions.

module.exports = {
  mode: 'development',
  entry: './src/index.ts',
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: ['.tsx', '.ts', '.js']
  },
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  }
};

Integration with webpack's watch mode

ts-loader works seamlessly with webpack's watch mode, which recompiles your code when changes are detected. This feature is useful for development as it provides a fast feedback loop.

webpack --watch

Source map support

ts-loader supports the generation of source maps, which help in debugging by mapping the compiled code back to the original TypeScript source code. The code sample shows how to enable inline source maps in your webpack configuration.

module.exports = {
  devtool: 'inline-source-map',
  // ... other webpack configuration
};

Other packages similar to ts-loader

Keywords

FAQs

Package last updated on 06 Jun 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc