Question

Is there a workaround to adding react as a templating engine?

In my server.js file, I have the following code:

const { createUpwardServer } = require('@magento/upward-js');

createUpwardServer({
    upwardPath: 'spec.yml',
    bindLocal: true,
    logUrl: true,
    port: 8080,
    before: (app) => {
        app.set('view engine', 'jsx')
        app.engine('jsx', require('express-react-views').createEngine());
        console.log(app);
    }
});

And in the spec file i have the following code

 body:
          resolver: template
          engine:
              resolver: inline
              inline: 'jsx'
          template:
            resolver: file
            file:
              resolver: inline
              inline: './templates/hello-world.jsx'
          provide:
              title:
                  resolver: inline
                  inline: 'This is the page title'

Yet I am facing TemplateResolver issue

Error: Template engine 'jsx' unsupported

Can you tell me what is it that I am missing here as well

PS: I already went through this part of the readme and it didn't help

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top