Socket
Socket
Sign inDemoInstall

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


Version published
Maintainers
3
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 03 Aug 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc