GithubHelp home page GithubHelp logo

Comments (8)

loganfsmyth avatar loganfsmyth commented on September 26, 2024

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.

CodePlayer7 avatar CodePlayer7 commented on September 26, 2024

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.

borela avatar borela commented on September 26, 2024

@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.

mezod avatar mezod commented on September 26, 2024

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.

loganfsmyth avatar loganfsmyth commented on September 26, 2024

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.

mezod avatar mezod commented on September 26, 2024

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.

loganfsmyth avatar loganfsmyth commented on September 26, 2024

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.

mezod avatar mezod commented on September 26, 2024

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)

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.