New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ts-tools/webpack-loader

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-tools/webpack-loader

TypeScript loader for webpack.

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@ts-tools/webpack-loader

npm version

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

FAQs

Package last updated on 13 Dec 2024

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