nvm use 8.6
Create your project from the newly created directory:
npm init -y
npm install webpack webpack-cli --save-dev
npm install -D babel-loader
npm install @babel/core -D
What was updated from Marcio's prior doc was https://www.npmjs.com/package/@babel/preset-es2015. Some of the "Babel" npm modules are now of the new name kind "@babel/preset-env"
npm install --save-dev @babel/preset-env
npm install --save-dev @babel/preset-react
npm install --save-dev css-loader
npm install style-loader -D
var path = require("path");
var DIST_DIR = path.resolve(__dirname, "dist");
var SRC_DIR = path.resolve(__dirname, "src");
var config = {
entry: [ SRC_DIR + "/index.js"],
output: {
path: DIST_DIR + "/",
filename: "bundle.js",
publicPath: "/"
},
module: {
rules: [
{
test: /\.js?/,
include: SRC_DIR,
loader: "babel-loader",
query: {
presets: ["@babel/preset-react", "@babel/preset-env"]
}
},
{
test: /\.css$/,
use: [ 'css-loader' ]
}
]
}
};
module.exports = config;
For reloading...
npm install webpack-dev-server --save-dev
npm run babel-start
Test with localhost:8080
npm install less -D
npm install less-loader --save-dev