Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-replace-webpack-pugin

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-replace-webpack-pugin - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

23

index.js

@@ -13,3 +13,2 @@ /**

}
HtmlResWebpackPlugin.prototype.apply = function(compiler, callback) {

@@ -19,8 +18,11 @@

replaceTo = this.options.to;
compiler.plugin('done', function() {
console.log('replace :< '+replaceFrom+"> to : <"+replaceTo+"> DONE");
});
compiler.plugin('emit', function(compilation, callback) {
for (var filename in compilation.assets) {
if(compilation.assets[filename].source().indexOf(replaceFrom)!=-1){
// Explore each chunk (build output):
compilation.chunks.forEach(function(chunk) {
// Explore each asset filename generated by the chunk:
chunk.files.forEach(function(filename) {
/*不包含css*/
if(filename.indexOf("css") == -1){
/*替换指定内容*/
var newStr = compilation.assets[filename].source().replace(replaceFrom,replaceTo);

@@ -31,3 +33,10 @@ compilation.assets[filename].source = function() {

}
}
// Get the asset source for each file generated by the chunk:
// var source = compilation.assets[filename].source();
});
});
compiler.plugin('done', function() {
/*构建完后需要执行的事情*/
console.log("执行完成")
});
callback();

@@ -34,0 +43,0 @@ });

{
"name": "html-replace-webpack-pugin",
"version": "1.0.2",
"version": "1.0.3",
"description": "替换webpack流生成后替换指定的内容",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -21,9 +21,3 @@ # html-replace-webpack-pugin

from:"sourceMappingURL=",
to:"sourceMappingURL=http://10.1.8.12:7000/load?src=medplus_h5/",
toServer:{
from: 'medplus_h5/js', // 要发送的文件目录
to: 'medplus_h5', // 在 sourcemap 文件服务器上保存的目录
match: '**/*.map', // 符合指定规则的文件
server: 'http://10.1.8.12:7000/upload' // sourcemap 文件服务器接受数据的接口
}
to:"sourceMappingURL=http://192.168.1.0"
}),

@@ -30,0 +24,0 @@ ],

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc