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

Vite 6.0.1 uses "hashed" name for style in manifest file #18807

Open
7 tasks done
karl-sjogren opened this issue Nov 27, 2024 · 0 comments
Open
7 tasks done

Vite 6.0.1 uses "hashed" name for style in manifest file #18807

karl-sjogren opened this issue Nov 27, 2024 · 0 comments

Comments

@karl-sjogren
Copy link

Describe the bug

In Vite 5 and 6 up to beta 4 our styles where in a file called styles.css in the manifest file.

6.0.0-beta4 and below

"style.css": {
  "file": "assets/style-eeRTlSgv.css",
  "src": "style.css"
}

6.0.0-beta5 and forward

"_style-DRNMkqs8.css": {
  "file": "assets/style-DRNMkqs8.css",
  "src": "_style-DRNMkqs8.css"
},

In the old version I could easily reference my specific css file in the manifest, but in the new format it seems to use the auto generated name in all three places.

I saw that the migration document talked about this in "library mode" which I'm currently not using. If this is an intended change outside of "library mode" as well then it should at least be documented as a breaking change.

Reproduction

https://stackblitz.com/edit/vitejs-vite-kfviyh?file=build-result%2Fvite-manifest.json

Steps to reproduce

npm run build in the linked stackblitz and check the manifest file (or just check the already built manifest file).

This is the vite.config.mjs used in the stackblitz.

export default defineConfig({
  build: {
    cssCodeSplit: false,
    outDir: resolve(__dirname, './build-result/'),
    manifest: 'vite-manifest.json',
    modulePreload: {
      polyfill: false,
    },
    rollupOptions: {
      input: resolve(__dirname, 'src/main.js'),
    },
  },
});

The style file is imported into src/main.js.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm

(from stackblitz)

Used Package Manager

npm

Logs

No response

Validations

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

No branches or pull requests

1 participant