Cannot find module

default discord avatar
2 months ago

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
    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!


Connect with the Payload Community on Discord



Can't find what you're looking for?

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