ctf0 / laravel-mix-versionhash

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

Version 1.1.5 breaks build with TypeError: mix.listen is not a function #38

Closed mfos239 closed 4 years ago

mfos239 commented 4 years ago

Version 1.1.2 works fine for me but 1.1.5 throws this error on build

TypeError: mix.listen is not a function at VersionHash.registerHashAssets (node_modules/laravel-mix-versionhash/src/index.js:194:13)

ctf0 commented 4 years ago

v1.1.3 added https://github.com/ctf0/laravel-mix-versionhash/commit/ecb992c4552ed3fa52017586925011c046f51197 v1.1.5 added https://github.com/ctf0/laravel-mix-versionhash/commit/751d0a23f21a267f040045171576d7590d16f4e3

so am not sure what exactly would have throw this, any ideas ?

mfos239 commented 4 years ago

1.1.3 builds without error. I found the breaking changes between 1.1.3 and 1.1.5 were introduced in this commit:

https://github.com/ctf0/laravel-mix-versionhash/tree/569e128713c32cdbb6e156aee360255b5a33c68b

Mix was changed to lowercase mix in the following instances:

mix.listen('build', () => { https://github.com/ctf0/laravel-mix-versionhash/commit/569e128713c32cdbb6e156aee360255b5a33c68b#diff-1fdf421c05c1140f6d71444ea2b27638R190

const file = File.find(${Config.publicPath}/${mix.manifest.name}) https://github.com/ctf0/laravel-mix-versionhash/commit/569e128713c32cdbb6e156aee360255b5a33c68b#diff-1fdf421c05c1140f6d71444ea2b27638R196

proxyMethod.before(mix, 'addTask', (task) => { https://github.com/ctf0/laravel-mix-versionhash/commit/569e128713c32cdbb6e156aee360255b5a33c68b#diff-1fdf421c05c1140f6d71444ea2b27638R222

If I change it back to Mix, the build succeeds.

ctf0 commented 4 years ago

ah yes,i made that change because of https://github.com/ctf0/laravel-mix-versionhash/blob/569e128713c32cdbb6e156aee360255b5a33c68b/src/index.js#L1 which is lower case

mfos239 commented 4 years ago

Yes but they are not the same

ctf0 commented 4 years ago

okay, np, can u plz send a PR ?

ctf0 commented 4 years ago

@mfos239 can u test the latest commit ?

mfos239 commented 4 years ago

I can test it tomorrow thank you

On Thu, Jul 2, 2020 at 7:29 PM Muah notifications@github.com wrote:

@mfos239 https://github.com/mfos239 can u test the latest commit ?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/ctf0/laravel-mix-versionhash/issues/38#issuecomment-653259670, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKHEZDTWQS3KH5DYUGCG53RZUJ5TANCNFSM4OPDW6AQ .

craigpotter commented 4 years ago

@ctf0 - I tested this commit and it works now. I was getting the same issue as @mfos239 before.

ctf0 commented 4 years ago

sorry for that, I will publish a new version today.

thanx again for reporting.

mfos239 commented 4 years ago

New version works perfect. Thanks for the quick fix @ctf0