Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

plugin-babel does not work #85

Open
nimo23 opened this issue Dec 15, 2017 · 1 comment
Open

plugin-babel does not work #85

nimo23 opened this issue Dec 15, 2017 · 1 comment

Comments

@nimo23
Copy link

nimo23 commented Dec 15, 2017

I am using System.js, JSPM, React.

I imported all plugins, however, react-files (jsx) does not transpile. I have this in jspm.config.js (jspm-version: 0.17.0-beta.47):

transpiler: "plugin-babel",
   packages: {
     "test": {
       "main": "test.js",
       "meta": {
         "*.js": {
           "loader": "plugin-babel",
           'format': 'esm',
           'babelOptions': {
             'modularRuntime': false,
             stage1: true,
             react: true,
             presets: ['babel-preset-react']
           }
         }
       }
     }
   }

when runing jspm build, I get this error:

[01:09:47] Starting 'jspm'...
       Building the bundle tree for src/index.js...
  
  err  Error on translate for test/index.js at file:///test/src/index.js
    SyntaxError: file:///test/src/index.js: Unexpected token (6:11)
    4 | var HelloMessage = React.createClass({
    5 |   render: function() {
  > 6 |     return <div>Hello {this.props.name}</div>;
      |            ^
    7 |   }
    8 | });

because jsx-file is not transpiled by babel. I can use "gulp-babel" and transpile it, then it works. But "jspm with plugin-babel" should do this also. What is wrong?

@nimo23
Copy link
Author

nimo23 commented Dec 15, 2017

I have also tried it with this. Does not work:

transpiler: "plugin-babel",
defaultExtension: true,
"format": "esm",
meta: {
    '*.jsx': {
      'babelOptions': {
      		"plugins": ["babel-plugin-transform-react-jsx"]
      }
    }
  },
packages: {
  "test": {
      "main": "index.js",
      "format": "esm",
      "meta": {
        "*.js": {
          "babelOptions": {
            "plugins": ["babel-plugin-transform-react-jsx"]
          }
        }
      }
    },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant