stealjs / transpile

Transpiles from everything to everything else
https://www.npmjs.com/package/transpile
MIT License
25 stars 10 forks source link

Problem with class properties #123

Open BigAB opened 6 years ago

BigAB commented 6 years ago

So, when using steal, the stage-2 ES feature Class Properties works with steal in the browser, but fails when building with steal-tools.

Here is a simple recreation gist: https://gist.github.com/anonymous/bd71f1e976b0cc568f1bdd36efea506b

Simply clone and run steal-tools (assuming you have steal-tools installed globally)

You will get an error like this: image

OPENING: ~/steal-tools-and-class-properties/package.json!npm
Transpiling...
ERROR: Unable to transpile steal-tools-and-class-properties@0.0.1#index: 

unknown: Missing class properties transform.
  1 | class Thing {
> 2 |   foo = () => {}
    |   ^
  3 | }
  4 | 
  5 | export default Thing
ERROR: 
Build failed

Which is weird in it's own right, but to add to the crazyness, all you need to do is add some config to the steal field in the package.json

{
  "name": "steal-tools-and-class-properties",
  "version": "0.0.1",
  "main": "index.js",
  "dependencies": {
    "steal-tools": "^1.9.1"
  },
  "steal": {
    "babelOptions": {
      "plugins": ["transform-class-properties"]
    }
  }
}

...and that FIXES it!

Weird huh?