V
V
VicTHOR2019-09-06 16:35:19
npm
VicTHOR, 2019-09-06 16:35:19

What babel preset is needed and how to connect it?

.babelrc
{
  "presets": [
    "@babel/preset-env"
  ],
  "plugins": [
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-syntax-import-meta",
    ["@babel/plugin-proposal-class-properties", { "loose": false }],
    "@babel/plugin-proposal-json-strings"
  ]
}
rules
module: {
    rules: [
        {
            test: /\.js$/,
            loader: 'babel-loader'
        }
    ]
},
code
class Something {
    #property;

    constructor() {
        this.#property = "test";
    }
}

const instance = new Something();
console.log(instance.property);

does not understand the private property .. and from core-js I don’t know where to import

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Edward Treit, 2019-09-10
@EdMSL

If you are using babel version 7, then the stage-3 preset and the others are marked as deprecated. https://babeljs.io/docs/en/babel-preset-stage-3
There is also a link to the documentation on what to do https://github.com/babel/babel/blob/master/package...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question