[TASK] Webpack 4 compatiblity
This commit is contained in:
parent
a9486c5634
commit
8571048b5e
6
index.js
6
index.js
@ -3,6 +3,8 @@ var mkdirp = require('mkdirp');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var RawSource = require("webpack-sources/lib/RawSource");
|
var RawSource = require("webpack-sources/lib/RawSource");
|
||||||
|
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
function HtmlWebpackAlterDataPlugin (options) {
|
function HtmlWebpackAlterDataPlugin (options) {
|
||||||
this.options = {
|
this.options = {
|
||||||
assetsConstants: false,
|
assetsConstants: false,
|
||||||
@ -44,7 +46,9 @@ HtmlWebpackAlterDataPlugin.prototype.apply = function (compiler) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
compiler.hooks.compilation.tap('HtmlWebpackAlterDataPlugin', (compilation) => {
|
compiler.hooks.compilation.tap('HtmlWebpackAlterDataPlugin', (compilation) => {
|
||||||
compilation.hooks.htmlWebpackPluginAfterHtmlProcessing.tapAsync('HtmlWebpackAlterDataPlugin', (data, cb) => {
|
const beforeEmit = compilation.hooks.htmlWebpackPluginAfterHtmlProcessing ||
|
||||||
|
HtmlWebpackPlugin.getHooks(compilation).beforeEmit;
|
||||||
|
beforeEmit.tapAsync('HtmlWebpackAlterDataPlugin', (data, cb) => {
|
||||||
data.html = data.html.replace('<!DOCTYPE html5>', '<!DOCTYPE html>');
|
data.html = data.html.replace('<!DOCTYPE html5>', '<!DOCTYPE html>');
|
||||||
data.html = data.html.replace(/<!--\|\%\|/g, '');
|
data.html = data.html.replace(/<!--\|\%\|/g, '');
|
||||||
data.html = data.html.replace(/\|\%\|-->/g, '');
|
data.html = data.html.replace(/\|\%\|-->/g, '');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user