Cannot find module

default discord avatar
Sasuke14120
2 months ago
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
    Payload Team
    2 months ago

    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>`
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.