
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.
file-wrapper-loader
Advanced tools
一个用于补充代码包裹的 webpack loader,用于在依赖代码前后注入包裹代码。
npm install --save-dev file-wrapper-loader
举个例子,在小程序端 import tim-wx-sdk 或 cos-wx-sdk-v5 包进来,在存在 window 对象的时候会运行报错,因此我们需要在运行依赖包前将 window 对象置空。我们可以对符合条件的代码前后追加内容,以达到在特殊场景的兼容效果:
module.exports = {
// ... 其他配置
module: {
rules: [
{
test: /tim-wx-sdk|cos-wx-sdk-v5/,
use: [{
loader: 'file-wrapper-loader',
options: {
before: 'var window=undefined;', // 代码前面追加内容
after: ';console.log("test");', // 代码后面追加内容
}
}],
include: /node_modules/,
},
// ... 其他 rule
],
},
}
FAQs
a loader for wrapper the import file
We found that file-wrapper-loader 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.