jantimon / html-webpack-plugin

Simplifies creation of HTML files to serve your webpack bundles
MIT License
10.72k stars 1.31k forks source link

fix: avoid importing all of lodash #1853

Open leventdeniz opened 4 months ago

leventdeniz commented 4 months ago

This PR reduces bundle size and makes it more resilient to use in monorepo setups using nx or yarn workspaces.

This specific error is fixed:

TypeError: _.uniq is not a function
    at HtmlWebpackPlugin.getAssetFiles (/app/node_modules/html-webpack-plugin/index.js:738:21)
    at HtmlWebpackPlugin.generateHTML (/app/node_modules/html-webpack-plugin/index.js:1025:46)
    at /app/node_modules/html-webpack-plugin/index.js:174:22
    at fn (/app/node_modules/webpack/lib/Compilation.js:510:9)
    at _next2 (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at eval (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:39:1)
    at eval (eval at create (/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
Bildschirmfoto 2024-07-11 um 10 48 16
alexander-akait commented 4 months ago

Can you fix tests?

leventdeniz commented 4 months ago

I'm not sure why the tests fail to be honest, it works on my machine (mac latest)

image
alexander-akait commented 4 months ago

I think there are different versions of packages for tests, i.e. just bump lock file here