nitro icon indicating copy to clipboard operation
nitro copied to clipboard

support `?raw` imports like vite does

Open fanckush opened this issue 1 year ago • 1 comments

Describe the feature

context: https://github.com/nuxt/nuxt/issues/21487

currently if a have universal-logic.ts that looks like this:

import file1 from './hello.txt?raw`

... other logic

Nitro (and thus Nuxt server) is not able to find the file. It would be great to have the ability to have truly universal imports across the server and the client and to allow even more code reuse

Additional information

  • [ ] Would you be willing to help implement this feature?

fanckush avatar Jan 26 '24 14:01 fanckush

We already have a raw loader. For sake for Vite consistency, ?raw seems a good alternative (also there were legacy reasons we were not resolving relative paths, now we don't have those)

pi0 avatar Jan 26 '24 17:01 pi0

~> https://github.com/unjs/nitro/issues/2390

pi0 avatar May 16 '24 21:05 pi0