最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - @symfonyux-react: ".reactcontrollers" This file can not be found, please check it for typos or update it

programmeradmin3浏览0评论

Trying to get @symfony/ux-react to work as per this documentation:

.html

Did the following steps

composer require symfony/ux-react
yarn add -D @babel/preset-react --force
yarn encore dev --watch

Also added the react.yaml file to config/packages

All seems to work fine but fails here:

import { registerReactControllerComponents } from '@symfony/ux-react';
registerReactControllerComponents(require.context('./react/controllers', true, /\.(j|t)sx?$/));

The error message is

"./assets/js/app.ts" contains a reference to the file "./react/controllers". This file can not be found, please check it for typos or update it if the file got moved.

Tried to use relative path but no success either.

What am I missing?

Trying to get @symfony/ux-react to work as per this documentation:

https://symfony/bundles/ux-react/current/index.html

Did the following steps

composer require symfony/ux-react
yarn add -D @babel/preset-react --force
yarn encore dev --watch

Also added the react.yaml file to config/packages

All seems to work fine but fails here:

import { registerReactControllerComponents } from '@symfony/ux-react';
registerReactControllerComponents(require.context('./react/controllers', true, /\.(j|t)sx?$/));

The error message is

"./assets/js/app.ts" contains a reference to the file "./react/controllers". This file can not be found, please check it for typos or update it if the file got moved.

Tried to use relative path but no success either.

What am I missing?

Share Improve this question edited Mar 31 at 14:42 hakre 198k55 gold badges449 silver badges855 bronze badges Recognized by PHP Collective asked Mar 31 at 14:34 nerdessnerdess 11k11 gold badges50 silver badges66 bronze badges 1
  • What is the --force being used for? And please run the composer diagnose function and put the command as well as the result into your question by editing it. – hakre Commented Mar 31 at 14:44
Add a comment  | 

1 Answer 1

Reset to default 0

Ok the issue was the path, that is the correct one: './../react/controllers'

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论