html-webpack-injector icon indicating copy to clipboard operation
html-webpack-injector copied to clipboard

RemoveDefer & typescript

Open tech-meppem opened this issue 2 years ago • 0 comments

I added an option called 'removeDefer' which removes the defer tag. This is useful if you set the scriptLoading: 'defer', option on the HtmlWebpackPlugin, as this way, you can have:

new HtmlWebpackPlugin({
    // Defer script loading for faster loading
    scriptLoading: 'defer',
    chunksConfig: {
        async: ["MyAsyncEntry"],
        removeDefer: ["MyAsyncEntry"],
    },
}),

And then MyAsyncEntry will only have async="async" as an attribute, and no longer will have defer="defer" as well.

I also added a typescript d.ts file, which augments the HtmlWebpackPlugin options to provide the types. Useful if you have your webpack files in typescript (like I do).

tech-meppem avatar Jan 23 '23 15:01 tech-meppem