Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

is it possible to use JSX? #126

Open
luman-web opened this issue Feb 1, 2021 · 1 comment
Open

is it possible to use JSX? #126

luman-web opened this issue Feb 1, 2021 · 1 comment
Labels
will be or is already fixed in vue3-sfc-loader see https://github.com/FranckFreiburger/vue3-sfc-loader

Comments

@luman-web
Copy link

luman-web commented Feb 1, 2021

i'm using the following preset to make jsx working in project https://github.com/vuejs/jsx
jsx renders perfectly within components that i create in source code of my project, but when i'm trying to execute component code using http-vue-loader, it falis.

here's what i'm trying to execute

<script>
module.exports = {
  render() {
     return <div>test 123</div>
  },
}
</script>

so i'm getting the following error output

vue.esm.js?a026:628 [Vue warn]: Failed to resolve async component: function() {
  return new Component(name).load(url)
  .then(function(component) {

    return component.normalize();
  })
  .then(function(component) {

    return component.compile();
  })
  .then(function(component) {

    var exports = component.script !== null ? component.script.module.exports : {};

    if ( component.template !== null )
      exports.template = component.template.getContent();

    if ( exports.name === undefined )
      if ( component.name !== undefined )
        exports.name = component.name;

    exports._baseURI = component.baseURI;

    return exports;
  });
}
Reason: SyntaxError: Unexpected token '<'

any chance to make the jsx code work with http-vue-loader?

@Toilal
Copy link

Toilal commented Feb 26, 2021

Use <script lang="jsx"> and implement the transformation manually in httpVueLoader.langProcessor.jsx

@FranckFreiburger FranckFreiburger added the will be or is already fixed in vue3-sfc-loader see https://github.com/FranckFreiburger/vue3-sfc-loader label Mar 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
will be or is already fixed in vue3-sfc-loader see https://github.com/FranckFreiburger/vue3-sfc-loader
Projects
None yet
Development

No branches or pull requests

3 participants