Skip to content

Instantly share code, notes, and snippets.

@cowchimp
Created January 2, 2017 10:55
Show Gist options
  • Save cowchimp/fd1f2d19ba55997d371e861d09ddd76f to your computer and use it in GitHub Desktop.
Save cowchimp/fd1f2d19ba55997d371e861d09ddd76f to your computer and use it in GitHub Desktop.
Trying to understand why `transform-decorators-legacy` isn't working
{
"presets": [
"es2015",
"react"
],
"plugins": [
"syntax-decorators",
"transform-decorators-legacy"
]
}
export function foo(a) {
console.log(a);
}
import React, { Component } from 'react';
import { foo } from './foo';
@foo('/') //if i comment this out then everything works
class HomePage extends Component {
render() {
return (
<div>
<h1>Hello World</h1>
</div>
)
}
}
export default HomePage;
<html>
<head>
<title>React Webpack template</title>
</head>
<body>
<div id="root">If you see this then something is wrong.</div>
<script src="dist/browser-bundle.js"></script>
</body>
</html>
import React from 'react';
import ReactDOM from 'react-dom';
import HomePage from './HomePage';
ReactDOM.render(<HomePage />, document.getElementById('root'));
{
"name": "react-webpack-template",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack --progress --colors --watch",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "BSD-2-Clause",
"dependencies": {
"react": "^0.14.5",
"react-dom": "^0.14.5"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.3.26",
"babel-loader": "^6.2.0",
"babel-plugin-syntax-decorators": "^6.13.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"webpack": "^1.12.9"
}
}
module.exports = {
entry: './index',
output: {
filename: 'dist/browser-bundle.js'
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader'
},
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment