-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Inline presets take precedence over .babelrc and it's not clear from the get-go. #202
Comments
To fix, I had to add the presets to the individual loader files, specifically.
Now I can use the nice shorthand arrow class functions. |
Oh yes, it's because we got inline presets so, it always takes precedence. Perhaps, we move this to .babelrc as it makes the configuration easier. |
@gauravtiwari I edited the issue title. I think .babelrc would be a great idea, all the babel presets I've read about online recommend using it via babelrc. |
Thumbs up since this bit me as well. For people with slightly more complicated loader configurations, such as, in my case where we are mixing coffeescript and jsx in order to get things working I had to modify my
Note the order was very important as well, and I also had to modify my
|
While ERROR in ./app/javascript/packs/components/pages/GroupMessagePage/index.js
Module build failed: SyntaxError: Missing class properties transform.
5 | export default class GroupMessagePage extends Component {
6 |
> 7 | sayHello = () => {
| ^
8 | console.log("Hello")
9 | }
10 |
module.exports = {
test: /\.(js|jsx)?(\.erb)?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: [
'es2015', 'react', 'stage-2',
['env', {modules: false}] // this line causes error when stage-2 enabled
]
}
} |
#264 addresses this |
Fixed by #291 |
Using Webpacker 1.1 and a brand new Rails 5.0.2.
Here's my simple React component for testing purposes.
The error I get is:
My .babelrc file looks like:
My package.json
Any ideas on how to make the class arrow functions working with Webpacker? It's like the stage-2 preset isn't being applied proper and I'm out of ideas.
Thanks for the help!
The text was updated successfully, but these errors were encountered: