
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
webpack-bundle-public-path-plugin
Advanced tools
dynamic override the webpack5 dynamic public path in web page runtime
webpack5 dynamic override public path in webPage runtime.
支持webpack5 动态改变webpack异步请求代码块(chunk请求前缀)以及静态资源(超出限制后的请求前缀) publicPath 路径
npm i -D webpack-bundle-public-path-plugin
// 配置
const WebpackBundlePublicPathPlugin = require('webpack-bundle-public-path-plugin');
plugins:[
// 顺序问题很重要,务必放在 HtmlWebpackPlugin 插件之前
new WebpackBundlePublicPathPlugin(), // 默认取 window.g_config.publicPath 或者 window.globalConfig.publicPath
// 或者 自定义配置带参数方式
new WebpackBundlePublicPathPlugin({
dynamicPublicPath:'"xxx code"'
})
]
方法1: 在入口文件index.html中 head 标签添加 script 代码
<script type="text/javascript">
window.g_config ={
publicPath:"http://localtest.me/webpackCode/webpack-bundle-public-path-plugin/example/dist/"
}
</script>
方法2
window.globalConfig.publicPath = "http://localtest.me/webpackCode/webpack-bundle-public-path-plugin/example/dist/"
自定义 publicPath 字符串或者 JS code
// mini-css-extract-plugin 修复的方法如下
{
loader: MiniCssExtractPlugin.loader,
options: {
// 重置publicPath
publicPath: (resourcePath, context) => {
return "";
}
}
},


FAQs
dynamic override the webpack5 dynamic public path in web page runtime
The npm package webpack-bundle-public-path-plugin receives a total of 1 weekly downloads. As such, webpack-bundle-public-path-plugin popularity was classified as not popular.
We found that webpack-bundle-public-path-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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.