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

[Bug Report]: 使用vite插件vite-plugin-compression不会压缩从public文件夹复制到dist文件夹的文件 #1793

Open
bddjr opened this issue Sep 26, 2024 · 2 comments
Labels

Comments

@bddjr
Copy link

bddjr commented Sep 26, 2024

Steps to reproduce

在public文件夹里放一个js文件,然后下载插件 https:/vbenjs/vite-plugin-compression

npm i vite-plugin-compression

然后在farm.config.ts新增内容

import viteCompression from 'vite-plugin-compression';

export default defineConfig({
  vitePlugins: [
    viteCompression({ algorithm: "brotliCompress" }),
    viteCompression({ algorithm: "gzip" }),
  ]

然后 npm run build ,再查看dist文件夹,会发现刚才放在public文件夹的js文件被复制到dist之后并没有被压缩。

该bug不会在vite出现,例如 https:/BCSPanel/frontend-login2

Reproduce link

https:/BCSPanel/frontend-antd

What is actually happening?

7122228a9a96bd18bbf1779470314afd
由此推断可能是时序问题造成的,在构建完成之后,运行插件之前,没有复制public文件夹

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 Intel(R) Core(TM) i5-10600KF CPU @ 4.10GHz
    Memory: 52.35 GB / 63.86 GB
  Binaries:
    Node: 20.12.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @farmfe/core: ^1.3.0 => 1.3.20
@ErKeLost
Copy link
Member

目前 public 文件夹会在 build 之后复制到 dist 目录, 这块我们改一下

@ErKeLost ErKeLost added the enhancement: pending triage Untriaged enhancement label Sep 26, 2024
@bddjr
Copy link
Author

bddjr commented Sep 26, 2024

改成构建之前复制应该就行了

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

No branches or pull requests

3 participants