suffix-resolve-plugin
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    suffix-resolve-plugin

    Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

    enhanced-resolve 插件,为了支持 resolve 不同优先级后缀路径

    如下:

    foo.js
    dir/
      index.js
      index.dev.js
      index.prod.js
    

    在 foo.js 中,require('./dir'), 将会根据 suffixList 的匹配顺序,依次进行命中,如 suffixList = ['.dev', ''] 则 require('./dir') 则会解析成 require('./dir/index.dev.js')

    Installation

    npm install suffix-resolve-plugin
    # or use yarn
    yarn add suffix-resolve-plugin

    Usage

    import { SuffixResolvePlugin } from 'suffix-resolve-plugin'
    
    webpackConfig = {
      resolve: {
        plugins: [
          new SuffixResolvePlugin({
            suffixList: ['.dev', ''],
            dir: contextPath
          })
        ]
      }
    }

    Contributing

    • Fork it!
    • Create your new branch:
      git checkout -b feature-new or git checkout -b fix-which-bug
    • Start your magic work now
    • Make sure npm test passes
    • Commit your changes:
      git commit -am 'feat: some description (close #123)' or git commit -am 'fix: some description (fix #123)'
    • Push to the branch: git push
    • Submit a pull request :)

    Authors

    This library is written and maintained by 余聪, yucong@yuanfudao.com.

    License

    MIT - 余聪 🐟

    Install

    npm i suffix-resolve-plugin

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    11.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • moyuyc