2

I have created jss project with react template, and I have added typescript support by installing some typescript libraries and adding to server.webpack.config.js next config:

module: {
rules: [
{
 test: /.(ts|tsx)?$/,
 exclude: /node_modules/,
 use: {
  loader: 'babel-loader',
  options: {
  babelrc: false,
  presets: [env, reactApp],
}...

and adding additional logic of checking ts/tsx extensions to generate-component-factory.js.

In connected mode everything is ok, but in integrated mode, after deploying I see desirable rendering but with styles which Sitecore adds if cannot find rendering.

In logs, I see errors like

Placeholder jss-main contains unknown component Header. Ensure that a React component exists for it, and that it is registered in your componentFactory.js.

Screenshots

Integrated Mode
image

Connected Mode
image

Using only js instead of ts everything works as expected. Has anyone come across a similar?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.