Comments (8)
If you have a specific PR in mind, I'd be happy to review it, but there are a massive number of ways to configure Babel depending on how you are using it. The README does includes an example using a .babelrc
which will also work with Webpack. Babel's docs and babel-loader
are generally the best places to look for docs around those things.
from babel-plugin-transform-decorators-legacy.
After using a .babelrc
config by following the usage example, webpack.config.js
still need to be configed in my case. As the usage only has few words and talks nothing about other config,whether this would be a note in usage section for beginners like me.
from babel-plugin-transform-decorators-legacy.
@CallMeXYZ I am defining the babel settings in my package.json without any issues; here's my loader settings.
from babel-plugin-transform-decorators-legacy.
I'm not sure if I understood OP correctly but I think I have the same issue:
If I config babel-plugin-transform-decorators-legacy using the .babelrc config, as suggested in the readme I get the full error:
ERROR in ./app/src/components/Menu/Menu.jsx
Module build failed: SyntaxError: Decorators are not officially supported yet in 6.x pending a proposal update.
However, if you need to use them you can install the legacy decorators transform with:
npm install babel-plugin-transform-decorators-legacy --save-dev
and add the following line to your .babelrc file:
{
"plugins": ["transform-decorators-legacy"]
}
The repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy.
which is exactly what I've already done.
However, if I instead add the plugin to my loader in webpack:
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
plugins: ['transform-decorators-legacy'],
presets: ['es2015', 'es2017', 'stage-0', 'react'],
},
},
I don't get the error.
from babel-plugin-transform-decorators-legacy.
The .babelrc
suggestion is standard because that is the usual place people put their config. If your other presets are configured as part of the loader, you'd also want to put the plugin there.
from babel-plugin-transform-decorators-legacy.
I understand/agree. My point was that for some reason, when doing it in .babelrc the error pops up whilst putting it on the webpack config file doesn't.
from babel-plugin-transform-decorators-legacy.
When you say you put it in the .babelrc
, you mean you configured the plugin there, but the presets were configured in the webpack.config.js
?
If so, the issue is that it would load the plugins in the wrong order if you do that.
from babel-plugin-transform-decorators-legacy.
That'd make a lot of sense. I'm not 100% if this is the answer to OP? Maybe you can close this issue :) thanks!
from babel-plugin-transform-decorators-legacy.
Related Issues (20)
- Error: Cannot read property of undefined. Static properties HOT 4
- @observable static has a Error
- Extract decorated functions as top level variables HOT 7
- Class property decorator hack. HOT 4
- What can be done to make decorators real in and move from stage-1 to stage-4? HOT 4
- [bug]Parameter Decorator does not work HOT 2
- About the parameter decorator support HOT 1
- Hook into initializer HOT 3
- Class property decorators gets applied before the class decorator itself HOT 4
- Issues with Electron HOT 19
- undefined is not a constructor (evaluating 'new u') HOT 2
- plugin not working HOT 4
- A issue in React-Native HOT 3
- Incorrect local name w/ native classes & babel-minify
- Maximum call stack size exceeded
- Clarify what babel's `legacy: true` is for exactly HOT 1
- Module build failed : Error:Cannot use the decorators and decorators-legacy plugin together
- Module parse failed: Unexpected character '@' (15:0)
- Audit vulnerabilities detected in the babelplugintransformdecoratorslegacy project on Tag: v1.3.5
- No lock file found in the babelplugintransformdecoratorslegacy project on Tag: v1.3.5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-transform-decorators-legacy.