suffix-resolve-plugin
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
orgit 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)'
orgit 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 - 余聪