Currently, https://remix.run/docs/en/main/file-conventions/asset-imports mentions:
Any files inside the
appfolder can be imported into your modules
and:
It [...] can be used for anything.
However, I just tried
import docxTemplate from './template.docx'
export default function Component() {
return <a href={docxTemplate}>link</a>
}
and it doesn’t work. I get a TypeScript error (Cannot find module './template.docx' or its corresponding type declarations.ts(2307)), which can be fixed by creating a template.docx.d.ts file:
// template.docx.d.ts
const url: string
export default url
Apart from this, however, I get the following ESBuild error:
✘ [ERROR] No loader is configured for ".docx" files: src/routes/component/template.docx
when running either remix dev or remix build.
I’m fine with putting the file in the public folder and using a hard-coded pathname to link to the file. However, given that the docs state that this should work for any file, I’m wondering if I’m doing something wrong.
Thanks in advance for your advice!