question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use file src path as keys in build manifest

See original GitHub issue
  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)

Describe the bug

Assets directories are not respected when generating a final build.

If your root is app/vite,

and your entrypoint file is app/vite/entrypoints/application.js

And in your entrypoint you import import "../images/nested/image.svg"

Your production build still keeps the image in the top level assets directory and doesnt transform it into: assets/images/nested/image[hash].svg Instead, it just stays as assets/image[hash].svg

Reproduction

Here’s the repo with the reproduction:

https://github.com/ParamagicDev/vite_rb/tree/69ec263155317924fec47485fc09d4b391768bc8

the app in question is in the examples/rails-without-webpack Directory.

to reproduce:

bundle install && yarn install && rails vite:build

this will then produce the final build files in the public/dist directory.

Additional info

I previously solved this when I made a Snowpack plugin for Rollup bundling and was curious if something similar would work here as well:

https://github.com/ParamagicDev/snowpack-plugin-rollup-bundle

System Info

  • vite version: ^2.0.0-beta.21
  • Operating System: MacOS Big Sur (M1)
  • Ruby version: 2.7.2
  • Node version: 14
  • Package manager (npm/yarn/pnpm) and version: yarn 1.22

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
yyx990803commented, Jan 25, 2021

This is a known issue - there’s actually a dedupe built-in here, but obviously the ideal format is using source paths relative to root as keys in the manifest - but that would technically be a breaking change which is why I haven’t done that yet.

0reactions
yyx990803commented, Jan 27, 2021

@leepowelldev yes, original extensions are preserved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage manifest files - Android Developers
This page describes how manifest merging works and how you can apply merge preferences to resolve merge conflicts.
Read more >
Gulp Rev doesn't include paths in my manifest file
I was having the same issue, and ended up renaming the asset dirs in the stream to what I wanted and specifying the...
Read more >
Manifest - Key - Chrome Developers
To get a suitable key value, first install your extension from a .crx file (you may need to upload your extension or package...
Read more >
The Manifest Format - The Cargo Book
The Cargo.toml file for each package is called its manifest. It is written in the TOML format. It contains metadata that is needed...
Read more >
Add a web app manifest
The web app manifest is a simple JSON file that tells the browser ... manifest file includes the app name, the icons the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found