Giter VIP home page Giter VIP logo

Comments (3)

SeanJM avatar SeanJM commented on May 4, 2024

Editing 'babel-helper-vue-jsx-merge-props' to export with default fixes it:

module.exports = { 
  default : function mergeJSXProps (objs) { ... }
}

from babel-helper-vue-jsx-merge-props.

SeanJM avatar SeanJM commented on May 4, 2024

Installing $ npm install --save-dev babel-preset-es2015 seems to fix the issue, except now I get this error with no answer online on how to resolve it: Left side of comma operator is unused and has no side effects. The error does away when the spread operator is not used.

babel.rc

{
  "presets": [],
  "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs"]
}

The line from the compiled code looks like this:

Vue.component('todoApp', {
        render: function (h) {
                return h("div", (0, _babelHelperVueJsxMergeProps2.default)([{ "class": "this" }, { class: "that" }]), []);
        }
});

from babel-helper-vue-jsx-merge-props.

SeanJM avatar SeanJM commented on May 4, 2024

This is the correct configuration to use for a TypeScript and JSX with Vue:

webpack.config.js:

module.exports = {
  entry: "./src/app.tsx",
  output: {
    filename: "bin/bundle.js"
  },
  resolve: {
    // Add '.ts' and '.tsx' as a resolvable extension.
    extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
  },
  module: {
    loaders: [
      // It's important to run 'babel' first this will avoid a compilation error
      { test: /\.tsx?$/, loader: "babel" },
      // Run ts loader to transform our typescript into JS
      { test: /\.tsx?$/, loader: "ts-loader" }
    ]
  },
  // If you want to load 'vue' as an external, and not include it in your bundle
  // simply add it to the array.
  externals : []
};

.babelrc

{
  "presets": [],
  "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs"]
}

Bash

npm i -S \
@types/core-js \
vue \
typescript \
ts-loader \
webpack \
babel \
babel-core \
babel-loader \
babel-plugin-syntax-jsx \
babel-plugin-transform-es2015-modules-commonjs \
babel-plugin-transform-vue-jsx \
babel-helper-vue-jsx-merge-props

from babel-helper-vue-jsx-merge-props.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.