
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
absolute-module-mapper-plugin
Advanced tools
The plugin on enhanced-resolver to map module path
It's helpful when we need to adjust third-party library dependencies. for example:
We have the follow project directory tree now.
project/
node_modules/
antd/
lib/
components/
icon/
index.js
button/
index.js # requires icon/index.js
...
wrapper/
button/
index.js
icon/
index.js
And the point is antd/button
requires antd/icon
, but we prefer it requires wrapper/icon
which we can customize.
So we could use this plugin in webpack, let antd/icon
in antd/button
is mapped to wrapper/icon
.
npm install absolute-module-mapper-plugin
# or use yarn
yarn add absolute-module-mapper-plugin
const AbsoluteModuleMapperPlugin = require('absolute-module-mapper-plugin')
const webpackConfig = {
resolve: {
plugins: [
new AbsoluteModuleMapperPlugin({
root: '/project',
include: [
'<root>/node_modules/antd/lib/components/button'
],
mapper: {
'^<root>/node_modules/antd/lib/components/icon/index.js': '<root>/wrapper/icon/index.js'
}
})
]
}
}
silent
Show some runtime log
true
root
Assign root path, it is the value for <root>
placeholder.
string
include
The included paths for mapping
Array<string|Function|RegExp>
[options.root]
exclude
The excluded paths for mapping
Array<string|Function|RegExp>
[]
mapper
absolute filename mapper.
(filename, ctx) => string | (filename, ctx, callback) => void | {}
{
'^<root>/from/(\w+)': '<root>/to/$1'
}
requestMapper
request mapper.
(request, ctx) => string | (request, ctx, callback) => void | {}
{
'^./a.js$': './b.js'
}
git checkout -b feature-new
or git checkout -b fix-which-bug
git commit -am 'feat: some description (close #123)'
or git commit -am 'fix: some description (fix #123)'
git push
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
MIT - imcuttle 🐟
FAQs
The plugin on enhanced-resolver to map module path
We found that absolute-module-mapper-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.