Skip to content

ux-react can not run with assetmapper #1732

Open
@langziyang

Description

@langziyang

i follow the document,

1、create new symfony project: symfony new --webapp .
2、install ux-react bundle: composer require symfony/ux-react
3、yarn add @babel/preset-react --dev --force
4、created react.yaml with https://symfony.com/bundles/ux-react/current/index.html#using-with-asset-mapper
5、copy https://github.com/symfony/ux/blob/2.x/ux.symfony.com/package.json to my package.json
6、call react_component on twig file: <div {{ react_component('Hello') }}>
7、modify app.js

// assets/app.js
import { registerReactControllerComponents } from '@symfony/ux-react';

registerReactControllerComponents(require.context('./react/controllers', true, /\.(j|t)sx?$/));

8、run yarn build-react
9、run php bin/console asset-map:compile

then i get error message on DevTools "Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec."

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueIdeal for your first contribution! (some Symfony or front-end experience may be required)ReactdocsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions