JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6496037
  • Score
    100M100P100Q225598F
  • License MIT

Load modules according to tsconfig paths in webpack.

Package Exports

  • tsconfig-paths-webpack-plugin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tsconfig-paths-webpack-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

tsconfig-paths-webpack-plugin

npm version code style: prettier MIT license

Use this to load modules whose location is specified in the paths section of tsconfig.json when using webpack.

How to install

yarn add --dev tsconfig-paths-webpack-plugin

or

npm install --save-dev tsconfig-paths-webpack-plugin

How to use

In your webpack config add this:

var TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

resolve: {
    plugins: [
        new TsconfigPathsPlugin(/* { configFileName: "path/to/tsconfig.json" } */)
    ]
}

Options

configFile (string) (default='tsconfig.json')

Allows you to specify where to find the TypeScript configuration file.

You may provide

  • just a file name. The loader then will search for the config file of each entry point in the respective entry point's containing folder. If a config file cannot be found there, it will travel up the parent directory chain and look for the config file in those folders.
  • a relative path to the configuration file. It will be resolved relative to the respective .ts entry file.
  • an absolute path to the configuration file.

silent (boolean) (default=false)

If true, no console.log messages will be emitted. Note that most error messages are emitted via webpack which is not affected by this flag.

logLevel (string) (default=warn)

Can be info, warn or error which limits the log output to the specified log level. Beware of the fact that errors are written to stderr and everything else is written to stderr (or stdout if logInfoToStdOut is true).

colors (boolean) (default=true)

If false, disables built-in colors in logger messages.

logInfoToStdOut (boolean) (default=false)

This is important if you read from stdout or stderr and for proper error handling. The default value ensures that you can read from stdout e.g. via pipes or you use webpack -j to generate json output.

How to test

To run the provided example:

yarn example

Prior work

This project uses work done in the awesome-typescript-loader.