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

Public folder is being ignored if root is set #36

Closed
2 tasks done
tiagoporto opened this issue Feb 26, 2024 · 1 comment
Closed
2 tasks done

Public folder is being ignored if root is set #36

tiagoporto opened this issue Feb 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@tiagoporto
Copy link

Describe the Bug

Hey, congratulations on this amazing plugin.

I'm trying to compress images from the public folder using a customized root folder.

Using default root config plugin works fine 😃

// vite.config.mjs
export default defineConfig({
  plugins: [
    ViteImageOptimizer({}),
  ],
})

Screenshot 2024-02-26 at 3 50 46 PM

Changing root path, public assets are not being compressed. 😢

// vite.config.mjs
export default defineConfig({
  root: './src',
  publicDir: '../public',
  build: {
    outDir: '../dist',
    emptyOutDir: true,
  },
  plugins: [
    ViteImageOptimizer({}),
  ],
})

Screenshot 2024-02-26 at 3 50 16 PM

Steps to reproduce

A broken example can be found on https://github.com/tiagoporto/sign-of-the-horns-single-div/blob/main/vite.config.mjs

npm run build

System Info

System:
    OS: macOS 13.6.2
    CPU: (12) arm64 Apple M2 Pro
    Memory: 2.95 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.15.4 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  Browsers:
    Chrome: 122.0.6261.69
    Chrome Canary: 124.0.6323.0
    Safari: 16.6
  npmPackages:
    vite: ^5.1.4 => 5.1.4 
    vite-plugin-image-optimizer: ^1.1.7 => 1.1.7 
    vite-plugin-minify: ^1.5.2 => 1.5.2 
    vite-plugin-pwa: ^0.19.0 => 0.19.0

Used Package Manager

npm

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@tiagoporto tiagoporto added the bug Something isn't working label Feb 26, 2024
pluederitz added a commit to pluederitz/vite-plugin-image-optimizer that referenced this issue Jun 24, 2024
could also fix similar issue: FatehAK#36
@tiagoporto
Copy link
Author

tiagoporto commented Jan 12, 2025

I can confirm this issue is fixed in release v1.1.8
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant