jantimon/html-webpack-plugin

Error on index.js source code

Creperi opened this issue · 1 comments

Current behaviour 💣

Hi. Everytime i include 'html-webpack-plugin on webpack.config.cjs file on my project, it gives me the following error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:119:11)
at Object.resolve (node:path:167:9)
at getFullTemplatePath (C:\Users\elias\OneDrive\Desktop\Folder\node_modules\html-webpack-plugin\index.js:1028:66)
at hookIntoCompiler (C:\Users\elias\OneDrive\Desktop\Folder\node_modules\html-webpack-plugin\index.js:174:22)
at C:\Users\elias\OneDrive\Desktop\Folder\node_modules\html-webpack-plugin\index.js:104:9
at Array.forEach ()
at C:\Users\elias\OneDrive\Desktop\Folder\node_modules\html-webpack-plugin\index.js:103:20
at Hook.eval [as call] (eval at create (C:\Users\elias\OneDrive\Desktop\Folder\node_modules\tapable\lib\HookCodeFactory.js:19:10), :7:1)
at Hook.CALL_DELEGATE [as _call] (C:\Users\elias\OneDrive\Desktop\Folder\node_modules\tapable\lib\Hook.js:14:14) {
code: 'ERR_INVALID_ARG_TYPE'
}

which means that path argument of index.js inside html-webpack-plugin must be of type string. I uninstalled and installed npm and no success. As a result i'm stuck here

Expected behaviour ☀️

Reproduction Example 👾

run 'npm install html-webpack-plugin' on terminal in the same project file and include it on webpack.config.cjs.

Environment 🖥

"dependencies": {
    "@googlemaps/google-maps-services-js": "^3.3.27",
    "css-loader": "^6.7.3",
    "html-webpack-plugin": "^5.5.0",
    "path": "^0.12.7",
    "react-scripts": "^5.0.1",
    "style-loader": "^3.3.2"
  },
  "devDependencies": {
    "webpack": "^5.76.3",
    "webpack-cli": "^5.0.1"
  }

my npm version: 9.4.0

You should not use the path module in such way, it is a standard Node.js module, please remove it from your package.json