harlan-zw / nuxt-webpack-optimisations

Make your Nuxt.js webpack builds faster ⚡
271 stars 8 forks source link

Throws error if /middleware doesn't exist #7

Closed toniengelhardt closed 3 years ago

toniengelhardt commented 3 years ago

Describe the bug

Throws a friendly error if the middleware directory doesn't exist.

ERROR  Failed to compile with 1 errors                                       

This relative module was not found:                                           

* ./middleware in ./.nuxt/auth.js    

To Reproduce

Expected behavior

Should work also without middleware dir, if you don't have any middleware there is no need for the directory. Nuxt itself also allows it.

Screenshots

Screen Shot 2021-02-11 at 19 32 43
harlan-zw commented 3 years ago

Thank you @toniengelhardt

Previously I was disabling the middleware nuxt feature if you didn't have the folder, but that was clearly a mistake.

The next patch won't have this logic and will resolve your issue.

toniengelhardt commented 3 years ago

Thanks @loonpwn, appreciate it!

toniengelhardt commented 3 years ago

Great module btw!