Open ykan opened 3 years ago
I am also facing this issue. Until there is a fix, I could modify the files that are causing the issue to get rid of these 404 errors, but could someone suggest potential options how to do it?
This discussion suggests a working hack: https://github.com/snowpackjs/snowpack/discussions/1589
Basically adding any code that emits as JavaScript to these interface files like types.ts
in this case:
export interface TextProps {
content?: string;
}
export const _SNOWPACK_HACK = true; // https://github.com/snowpackjs/snowpack/issues/3585
But is there anything more elegant? I could potentially restructure my project in a way that all my interfaces are in one folder / barrel (index.ts-file). Could I then get that whole barrel ignored in Snowpack some way? I need to export them for my rollup build, so removing the interface exports completely is not a solution. And also not having a barrel-file (referencing interfaces one-by-one) seems a bit clumsy.
EDIT: The above code has a problem when you apply it to multiple files. This works better (essentially, I just run a noop instead of exporting anything):
(()=>{ /* Snowpack Noop HACK for: https://github.com/snowpackjs/snowpack/issues/3585 */ })();
I'm getting this too. I don't know how more people aren't running into this.
I just get a stream of 404s for most of the shared/helper files in my project that just expose types. At first I thought the entire build was broken, but then noticed that only some of them were giving 404s/missing in the output and theorized it might be because they only contained types. I tried to track down what was up with this earlier in the day, and I think the problem is around esbuild basically generating an empty-string output for the file, which then makes snowpack think it wasn't valid.
Quick checklist
What package manager are you using?
yarn
What operating system are you using?
macOS
Describe the bug
I have a component , the file struct is like:
Then I use like this:
And I found this error:
Steps to reproduce
types.ts
file,if you addexport const a = 1
, it will turn right.Link to minimal reproducible example (optional)
https://codesandbox.io/s/beautiful-hermann-44wde