How to use the tsconfig-paths-webpack-plugin function in tsconfig-paths-webpack-plugin

To help you get started, we’ve selected a few tsconfig-paths-webpack-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bennymeg / nx-electron / src / utils / config.ts View on Github external
test: /\.(j|t)sx?$/,
          loader: `ts-loader`,
          options: {
            configFile: options.tsConfig,
            transpileOnly: true,
            // https://github.com/TypeStrong/ts-loader/pull/685
            experimentalWatchApi: true
          }
        }
      ]
    },
    resolve: {
      extensions,
      alias: getAliases(options),
      plugins: [
        new TsConfigPathsPlugin({
          configFile: options.tsConfig,
          extensions,
          mainFields
        })
      ],
      mainFields
    },
    performance: {
      hints: false
    },
    plugins: [
      new ForkTsCheckerWebpackPlugin({
        tsconfig: options.tsConfig,
        workers: options.maxWorkers || ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
        useTypescriptIncrementalApi: false // FIXME: disabled incremental api in favour of max workers until it will be supported
      })
github lskjs / lskjs / packages / build / src2 / WebpackConfig.js View on Github external
getResolve() {
    return {
      /* root: this.resolvePath('src'),
      modulesDirectories: ['node_modules'], */
      alias: this.getResolveAlias(),
      extensions: this.getResolveExtensions(),
      modules: [
        this.resolvePath('src'),
        'node_modules',
      ],
      ...(this.isTypescriptSupport() ? {
        plugins: [
          new TsconfigPathsPlugin({ configFile: this.resolvePath('tsconfig.json') }),
        ],
      } : {}),
    };
  }
github lskjs / lskjs / packages / lsk-build / src / WebpackConfig.js View on Github external
getResolve() {
    return {
      /* root: this.resolvePath(srcDir),
      modulesDirectories: ['node_modules'], */
      alias: this.getResolveAlias(),
      extensions: this.getResolveExtensions(),
      modules: [
        this.resolvePath(srcDir),
        'node_modules',
      ],
      ...(this.isTypescriptSupport() ? {
        plugins: [
          new TsconfigPathsPlugin({ configFile: this.resolvePath('tsconfig.json') }),
        ]
      } : {}),
    };
  }
github nrwl / nx / packages / node / src / utils / config.ts View on Github external
test: /\.(j|t)sx?$/,
          loader: `ts-loader`,
          options: {
            configFile: options.tsConfig,
            transpileOnly: true,
            // https://github.com/TypeStrong/ts-loader/pull/685
            experimentalWatchApi: true
          }
        }
      ]
    },
    resolve: {
      extensions,
      alias: getAliases(options),
      plugins: [
        new TsConfigPathsPlugin({
          configFile: options.tsConfig,
          extensions,
          mainFields
        })
      ],
      mainFields
    },
    performance: {
      hints: false
    },
    plugins: [
      new ForkTsCheckerWebpackPlugin({
        tsconfig: options.tsConfig,
        workers: options.maxWorkers || ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
        useTypescriptIncrementalApi: false
      })
github lskjs / lskjs / packages / lsk-modules / packages / build / src / WebpackConfig.js View on Github external
getResolve() {
    return {
      /* root: this.resolvePath(srcDir),
      modulesDirectories: ['node_modules'], */
      alias: this.getResolveAlias(),
      extensions: this.getResolveExtensions(),
      modules: [
        this.resolvePath(srcDir),
        'node_modules',
      ],
      ...(this.isTypescriptSupport() ? {
        plugins: [
          new TsconfigPathsPlugin({ configFile: this.resolvePath('tsconfig.json') }),
        ]
      } : {}),
    };
  }
github pixeloven / pixeloven / packages / pixeloven-storybook / config / src / webpack.config.ts View on Github external
}
        // Extensions
        if (config.resolve.extensions) {
            config.resolve.extensions.push(".ts", ".tsx");
        } else {
            config.resolve.extensions = [".ts", ".tsx"];
        }
        // Modules
        if (config.resolve.modules) {
            config.resolve.modules.push(resolveSourceRoot());
            config.resolve.modules.push("node_modules");
        } else {
            config.resolve.modules = [resolveSourceRoot(), "node_modules"];
        }
        // Resolve
        const tsPathPlugin = new TsconfigPathsPlugin({
            configFile: resolveTsConfig(),
        });
        if (config.resolve.plugins) {
            config.resolve.plugins.push(tsPathPlugin);
        } else {
            config.resolve.plugins = [tsPathPlugin];
        }
    }
    return config;
}
github nrwl / nx / packages / next / src / utils / config.ts View on Github external
return function webpackConfig(config, { defaultLoaders }) {
    const mainFields = ['es2015', 'module', 'main'];
    const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
    config.resolve.plugins = [
      new TsConfigPathsPlugin({
        configFile: path.resolve(root, 'tsconfig.json'),
        extensions,
        mainFields
      })
    ];
    config.module.rules.push({
      test: /\.tsx/,
      use: [defaultLoaders.babel]
    });
    return config;
  };
}

tsconfig-paths-webpack-plugin

Load modules according to tsconfig paths in webpack.

MIT
Latest version published 7 days ago

Package Health Score

89 / 100
Full package analysis

Similar packages