Is it okay to use babel-node in production

For the client side code, you’re doing the correct thing. babelify it and ship it to the client. For the server side code, I would just do a regular build using babel-cli According to http://babeljs.io/docs/setup/#babel_register, babel-register is not meant for production use — The require hook is primarily recommended for simple cases. for Babel 6+ … Read more

Babel command not found

There are two problems here. First, you need a package.json file. Telling npm to install without one will throw the npm WARN enoent ENOENT: no such file or directory error. In your project directory, run npm init to generate a package.json file for the project. Second, local binaries probably aren’t found because the local ./node_modules/.bin … Read more

Error: Missing class properties transform

You need to install @babel/plugin-proposal-class-properties: npm install @babel/plugin-proposal-class-properties –save-dev or yarn add @babel/plugin-proposal-class-properties –dev and add the following to your Babel configuration file – usually .babelrc or babel.config.js. “plugins”: [“@babel/plugin-proposal-class-properties”],

UglifyJS throws unexpected token: keyword (const) with node_modules

As ChrisR mentionned, UglifyJS does not support ES6 at all. You need to use terser-webpack-plugin for ES6 (webpack@5 will use this plugin for uglification) npm install terser-webpack-plugin –save-dev Then define in your plugins array const TerserPlugin = require(‘terser-webpack-plugin’) new TerserPlugin({ parallel: true, terserOptions: { ecma: 6, }, }), Source

`regeneratorRuntime` is not defined when running Jest test

In case you are using a setupTests.js file you can import regenerator-runtime from there: // setupTests.js import ‘regenerator-runtime/runtime’ import Enzyme from ‘enzyme’ import EnzymeAdapter from ‘enzyme-adapter-react-16’ Enzyme.configure({ adapter: new EnzymeAdapter() })   Then you can import setupTests.js to every test file or better yet, in your package.json just add setupFilesAfterEnv to the jest config: // … Read more

Babel unexpected token import when running mocha tests

For Babel <6 The easiest way to solve this problem is: npm install babel-preset-es2015 –save-dev Add .babelrc to the root of the project with contents: { “presets”: [ “es2015″ ] } Ensure that you are running mocha with the “–compilers js:babel-core/register” parameter. For Babel6/7+ npm install @babel/preset-env –save-dev Add .babelrc to the root of the … Read more

Can’t require() default export value in Babel 6.x

TL;DR You have to use const app = require(‘./app’).default; app(); Explanation Babel 5 used to have a compatibility hack for export default: if a module contained only one export, and it was a default export, it was assigned to module.exports. So, for example, your module app.js export default function () {} would be transpiled to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)