Baroshem / compression

🗜 Compression module for Nuxt 3
https://compression-nm.netlify.app/
MIT License
32 stars 0 forks source link

deleteOriginFile options is not working as expected #3

Closed BenjaminOddou closed 1 year ago

BenjaminOddou commented 2 years ago

Hello,

I'd like to report that the deleteOriginFile: true is not working as expected and return an error :

 ERROR  Rollup error: Could not load /Users/User/Documents/nuxt-app/.nuxt/dist/server/client.manifest.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/Users/User/Documents/nuxt-app/.nuxt/dist/server/client.manifest.mjs'

 ERROR  Could not load /Users/User/Documents/nuxt-app/.nuxt/dist/server/client.manifest.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/Users/User/Documents/nuxt-app/.nuxt/dist/server/client.manifest.mjs'

here is my nuxt.config.ts file :

  buildModules: [
    [
      '@nuxt-modules/compression',
      {
        algorithm: 'gzip',
        filter: /\.(js|mjs|css|html)$/i,
        deleteOriginFile: true,
        success: () => {
          console.log('✅ Success gzip compression')
        }
      }
    ]
  ],
BenjaminOddou commented 1 year ago

cc @Baroshem

Baroshem commented 1 year ago

I will work on it with the upgrade to latest Nuxt 3 format. Thanks for reporting that.

I expect to release a new version of this module until the end of the week (bit busy right now with other tasks unfortunately :( )

Baroshem commented 1 year ago

Hey @BenjaminOddou

I tried to port the module to the current version of Nuxt but I am experiencing some issues along the way. Could you please use the vite-plugin-compression for now while in the meantime I will try to fix these bugs and update the module?

Sorry for that, I have not expected so many problems along the way :(

BenjaminOddou commented 1 year ago

No problem I totally understand ! The current version of your plugin is working so not a deal breaker. I'll wait your input to test the new version 😉

BenjaminOddou commented 1 year ago

@Baroshem did you succeeded to update the plugin 🙂?

Baroshem commented 1 year ago

Hey, no I cannot make it work. Some strange issues while prting the module. I will try to make it completely from scratch instead.

Baroshem commented 1 year ago

Hey, I tried to rebuild the module but failed. Not sure what are causing the module to not work unfortunatelly.

At this point, I recommend you to just use the vite-plugin-compression directly in your nuxt project instead of the module I created. Because it is just a wrapper around another plugin I decided that I will deprecate it as it does not work currently and the similar functionality can be easily used with the plugin directly.

Sorry for the trouble.

If you like working with Nuxt modules, I can highly recommend you to check out https://github.com/nuxt-modules/algolia and https://github.com/Baroshem/nuxt-security. I am working on these modules on the daily basis so maybe you will find some of them useful in your next (Nuxt) project.

BenjaminOddou commented 1 year ago

Hey @Baroshem thanks for the feedback. I opted to use nitro asset compression :

  nitro: {
    compressPublicAssets: {
      brotli: true,
      gzip: false
    }
  }