webpack ts-loader官方github及其兼容性

点击 网页https://webpack.docschina.org/loaders/ 中的 “ts-loader”链接:

 

 

 到达ts-loader官方github (https://github.com/TypeStrong/ts-loader#running),搜索“Compatibility”,看到ts-loader的兼容性

 

Compatibility

    • TypeScript: 3.6.3+
    • webpack: 4.x+ (please use ts-loader 3.x if you need webpack 2 or 3 support)
    • node: 6.11.5 minimum (aligned with webpack 4)

看到 ts-loader的配置

 看到 baseUrl / paths module resolution

baseUrl / paths module resolution

If you want to resolve modules according to baseUrl and paths in your tsconfig.json then you can use the tsconfig-paths-webpack-plugin package. For details about this functionality, see the module resolution documentation.

This feature requires webpack 2.1+ and TypeScript 2.0+. Use the config below or check the package for more information on usage.

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

module.exports = {
  ...
  resolve: {
    plugins: [new TsconfigPathsPlugin({ configFile: "./path/to/tsconfig.json" })]
  }
  ...
}
posted @ 2021-02-08 17:39  py2020  阅读(1043)  评论(0)    收藏  举报