Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Cannot find module

default discord avatar
sasuke14120last year
1

I have a html file in the

src/utils directory

and tried importing this file in a collection, but was unable to because it says cannot find the module.Please help me with this.



  • discord user avatar
    tylandavis
    last year

    HTML files cannot be imported as modules, only Javascript/Typescript. You would need to export your HTML code as a string within a JS or TS file:



    // yourHtmlFile.js
    
    export default html = `<html>...</html>`
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.