Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE in nuxt-precompress module #229

Open
LavanyaPatial opened this issue Jul 7, 2023 · 5 comments
Open

ISSUE in nuxt-precompress module #229

LavanyaPatial opened this issue Jul 7, 2023 · 5 comments

Comments

@LavanyaPatial
Copy link

image

i have added the nuxt-precompress module in the module section of nuxt.config.ts and getting this error
followed the step mentioed in warning, set type: module in package.json.. still its the same issue.

@zhinea
Copy link

zhinea commented Jul 12, 2023

same here

@niu-grandpa
Copy link

me too

@LavanyaPatial
Copy link
Author

Nuxt precompress module didnt work for me.
A solution to optimize the speed of your Nuxt application is using nuxt-delay-hydration module and configure your server to serve compressed file or to enable text compression.

Nuxt automatically compress the files in gzip format as it runs Gzip compression during the build process.

Nuxt-delay-hydration module restrict any third party script to run until hydration is completed. which increase performance of Nuxt application.

https://www.npmjs.com/package/nuxt-delay-hydration

@maddocnc
Copy link
Collaborator

maddocnc commented Sep 1, 2023

nuxt-precompress is only nuxt2 compatible for now, as it depends on old webpack, if there is interest in upgrading it for Nuxt 3 I'll do it.

@niu-grandpa
Copy link

niu-grandpa commented Sep 6, 2023

You should install the "vite-plugin-compression" plugin in nuxt3,and like this to using 👇

import viteCompression from 'vite-plugin-compression';
export default defineNuxtConfig({
  vite: {
    plugins: [
        viteCompression({
            verbose: true, // 是否在控制台中输出压缩结果
            disable: false,
            threshold: 10240, // 如果体积大于阈值,将被压缩,单位为b,体积过小时请不要压缩,以免适得其反
            algorithm: 'gzip', // 压缩算法,可选['gzip',' brotliccompress ','deflate ','deflateRaw']
            ext: '.gz',
            deleteOriginFile: false, // 源文件压缩后是否删除
        })       
    ]
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants