-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Merge pull request #55 from Austaras/develop
feat: support htmlwebpackplugin v4
- Loading branch information
Showing
5 changed files
with
34 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getHooks, AlterAssetTagsData, HtmlTag } from 'html-webpack-plugin' | ||
import { compilation } from 'webpack' | ||
import Compilation = compilation.Compilation | ||
|
||
const isV4 = typeof getHooks !== 'undefined' | ||
|
||
export const getBodyTags = (data: AlterAssetTagsData): HtmlTag[] => | ||
isV4 ? (data as any).bodyTags : data.body | ||
export const setBodyTags = (data: AlterAssetTagsData, body: HtmlTag[]): void => { | ||
isV4 ? (data as any).bodyTags = body : data.body = body | ||
} | ||
export const getHeadTags = (data: AlterAssetTagsData): HtmlTag[] => | ||
isV4 ? (data as any).headTags : data.head | ||
|
||
export const getAlterAssetTags = (compilation: Compilation): any => | ||
isV4 ? getHooks(compilation).alterAssetTagGroups : compilation.hooks.htmlWebpackPluginAlterAssetTags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters