Refactoring Legacy Code: 02 Moving to ECHMAScript 2015
In this episode, we are going to continue refactoring a legacy NodeJs application. We are now going to start by setting up babel so that it supports ECMAScript 2015 (ES6). # Dependencies npm install --save-dev @babel/core @babel/cli @babel/preset-env babel-jest # Use present-env to handle automatic transformation: .babelrc { "presets": ["@babel/preset-env"] } # Configure jest, jest.config.json: { "transform": { "^.+\\.js$": "babel-jest" } } # Configure build "build": "babel src --out-dir dist", "start": "npm run build && node dist/index.js" #softwaredeveloper #nodejs
In this episode, we are going to continue refactoring a legacy NodeJs application. We are now going to start by setting up babel so that it supports ECMAScript 2015 (ES6). # Dependencies npm install --save-dev @babel/core @babel/cli @babel/preset-env babel-jest # Use present-env to handle automatic transformation: .babelrc { "presets": ["@babel/preset-env"] } # Configure jest, jest.config.json: { "transform": { "^.+\\.js$": "babel-jest" } } # Configure build "build": "babel src --out-dir dist", "start": "npm run build && node dist/index.js" #softwaredeveloper #nodejs