0.0.3 • Published 5 years ago

ts-rootdirs-webpack-plugin v0.0.3

Weekly downloads
6
License
ISC
Repository
github
Last release
5 years ago

ts-rootdirs-webpack-plugin

Resolve tsconfig.compilerOptions.rootDirs.

Usage

Install

npm i -D ts-rootdirs-webpack-plugin

Config

// webpack.config.js
const webpackplugin = new (require('ts-rootdirs-webpack-plugin')).default();

module.exports = {
  ...
  resolve: {
    plugins: [webpackplugin]
  }
}

Example

// tsconfig.json
{
  "compilerOptions": {
    ...
   "rootDirs": ["locale/zh", "locale/a/b/c/#{locale}"],
    ...
  }
}
import locale from '../../locale/a/b/c/#{locale}/message.json';
   ||
   ▽
const message_json_1 = __importDefault(__webpack_require__(/*! ../../locale/zh/message.json */ "./locale/zh/message.json"));