Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jspm 0.17.0-beta.12: babel-plugin-transform-react-jsx does not transpile all files #1671

Closed
m-a-r-c-e-l-i-n-o opened this issue Apr 2, 2016 · 1 comment

Comments

@m-a-r-c-e-l-i-n-o
Copy link

Not sure if this is a jspm beta bug, a configuration issue or a karma-jspm issue, was hoping someone could shed some light. Consider the following test file:

import ReactTestUtils from 'react-addons-test-utils'
import HelloWorld from '../../src/client/index'

describe ( 'HelloWorld component', function () {

    it ( 'should render "Hello World!" component.', function () {

        var helloWorld = ReactTestUtils.renderIntoDocument( <HelloWorld /> );
    });
} );

This throws an "Unexpected token" error because <HelloWorld /> is not being transpiled. The weird thing is that the'../../src/client/index' dependency also has components within it, and the JSX in those imported files get transpiled just fine. Only the JSX in the entry test file (containing the "describe" blocks) fails to be transpiled. Somehow "babel-plugin-transform-react-jsx" chooses to ignore the entry test file.

Although I'm using karma-jspm ( https://github.com/Workiva/karma-jspm ) to manage the tranpiling step, I believe this might be an jspm issue since it's responsible for detecting when a tranpiler is needed. Is there something I can do to force to the "babel-plugin-transform-react-jsx" to be active on those entry test files?

Transpiler config ( jspm version: 0.17.0-beta.12 [Running against local jspm install.] ):

SystemJS.config({
  transpiler: "plugin-babel",
  packages: {
    "app": {
      "main": "src/client/index.js",
      "format": "esm",
      "meta": {
        "*.js": {
          "loader": "plugin-babel",
          "babelOptions": {
            "plugins": [
              "babel-plugin-transform-react-jsx"
            ]
          }
        }
      }
    }
  }
});
@m-a-r-c-e-l-i-n-o m-a-r-c-e-l-i-n-o changed the title jspm 0.17 beta: babel-plugin-transform-react-jsx does not transpile all files jspm 0.17.0-beta.12: babel-plugin-transform-react-jsx does not transpile all files Apr 2, 2016
@m-a-r-c-e-l-i-n-o
Copy link
Author

It was a jspm configuration issue, sorry about that. It appears that only files in the "src" (or whatever your app folder is) gets transpiled. Looking at the structure of the "jspm.config.js" file, I can now see how that makes sense.

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

No branches or pull requests

1 participant