How to make script type both text/babel and module?

后端 未结 4 852
遥遥无期
遥遥无期 2021-02-07 06:59

It works perfectly because I haven\'t included JSX, but when I replace the script type with text/babel, it doesn\'t work because the module fails to load. bro

4条回答
  •  你的背包
    2021-02-07 07:06

    As mentioned in the docs, it's added in: v7.10.0.

    If you want to use your browser's native support for ES Modules, you'd normally need to set a type="module" attribute on your script tag.

    With @babel/standalone, set a data-type="module" attribute instead, like this:

提交回复
热议问题