I want to add some react js files to a theme's libraries.yml and I don't know how I can do this in drupal 8.

<script type="text/babel" src="scripts/example.js"></script> or <script type="text/jsx" src="scripts/example.js"></script>

I can't figure it out hot to make the type="text/jsx" appear when the file is added to the page.

Any ideas on how I can achieve this in Drupal 8?


I took a wild guess because I couldn't find absolutely nothing. Apparently this works:

  version: 1.x
    js/node.js: { attributes: {type: text/babel} }

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.