vuejs / babel-plugin-transform-vue-jsx

babel plugin for vue 2.0 jsx
1.85k stars 132 forks source link

How can I get this to run in a codebase with both react and vue files? #162

Closed bcliffor closed 5 years ago

bcliffor commented 5 years ago

I have a codebase with both react files and vue files and using webpack. I would like to write jsx in the vue files. My problem is that if I include this plugin in my root .babelrc then it attempts to apply itself to my react files as well which incorrectly wraps them in the h function.

I have been trying to tell the webpack vue loader to run with the necessary babel options with variants similar to:

  test: /\.vue$/,
  loader: 'vue-loader',
  options: {
    loaders: {
      js: {
        loader: 'babel-loader',
        options: {
          plugins: ['transform-vue-jsx'],
        },
      },
    },
  },
}

But I haven't been able to get it to transforming anything.

Does anyone have tips on getting this plugin to run on JUST vue files?

Thanks! (and let me know if this would be better posted to the vue-loader issues)

nickmessing commented 5 years ago

There is no way. Unfortunately it's impossible to use in same webpack config both react transform and vue transform.