ctf0 / laravel-mix-versionhash

Auto append hash to file instead of using virtual one
MIT License
61 stars 18 forks source link

The "path" argument must be of type string. Received function chunkFilename #45

Closed BooStudio closed 3 years ago

BooStudio commented 3 years ago

I have been using this plugin for some time now but it doesn't seem to work with the latest mix version I recon,

it gives error -

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received function chunkFilename
    at new NodeError (node:internal/errors:329:5)
    at validateString (node:internal/validators:129:11)
    at Object.dirname (node:path:1172:5)
    at VersionHash.webpackConfig (/Users/files/node_modules/laravel-mix-versionhash/src/index.js:78:34)
    at /Users/files/node_modules/laravel-mix/src/components/ComponentRegistrar.js:106:54
    at /Users/files/node_modules/laravel-mix/src/Dispatcher.js:37:62
    at Array.map (<anonymous>)
    at Dispatcher.fire (/Users/filesnode_modules/laravel-mix/src/Dispatcher.js:37:47)
    at Mix.dispatch (/Users/filees/node_modules/laravel-mix/src/Mix.js:224:32)
    at WebpackConfig.build (/Users/files/node_modules/laravel-mix/src/builder/WebpackConfig.js:36:19)
    at async /Users/files/node_modules/webpack-cli/lib/webpack-cli.js:1222:37
    at async Promise.all (index 0)
    at async evaluateConfig (/Users/files/node_modules/webpack-cli/lib/webpack-cli.js:1213:35)
    at async Promise.all (index 0)
    at async WebpackCLI.resolveConfig (/Users/files/node_modules/webpack-cli/lib/webpack-cli.js:1244:38)
    at async WebpackCLI.createCompiler (/Users/files/node_modules/webpack-cli/lib/webpack-cli.js:1670:22) {
  code: 'ERR_INVALID_ARG_TYPE'

I tried some edits to the plugin, which makes it work it's dirty but it's working for now,

Edit in index.js

Screen Shot 2021-02-16 at 4 35 04 pm

changed this line 'webpackConfig.output.chunkFilename' to 'typeof webpackConfig.output.chunkFilename != "function" '

ctf0 commented 3 years ago

can u make a pr with the changes ?

BooStudio commented 3 years ago

Donski mate!

BooStudio commented 3 years ago

47

marhyn commented 3 years ago

Sweet! Could you release this fix, please? 🙏🏾

ctf0 commented 3 years ago

done