Skip to content

[Question] how to transpile 'components/Fragment.tsx' #53

Description

@GuanJdoJ

I'm learning react-esi from this react-esi-demo

//server.js
...
server.get(path, (req, res) =>
    serveFragment(
      req,
      res,
      fragmentID => require(`./components/${fragmentID}`).default
    )
  )
...

In server.js, the resovle will get Component from dist which was transpiled by babel.

//.babelrc
{
  "presets": ["next/babel"]
}

When fragment component is js(In this README.md, the example also uses js), babel works well. But when fragment component is tsx, babel doesn't handle it. And when I import less in components/Fragment.tsx, the style file will not be transpiled to dist.

Could you please tell me what should I do, thx!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions