From 96d3392784088c17a6f35ed25e308d649aaa59a2 Mon Sep 17 00:00:00 2001 From: Sandesh Thapa <63294026+Sandesh-Thapa@users.noreply.github.com> Date: Thu, 27 Apr 2023 08:50:32 +0545 Subject: [PATCH] Update .babelrc to skip importing react on every component, Added entry and output configuration in webpack.config.js, use webpack.config.js config in package.json scripts --- .babelrc | 5 ++++- package.json | 4 ++-- webpack.config.js | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.babelrc b/.babelrc index 5161109..62e9709 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,7 @@ { - "presets": ["@babel/preset-env", "@babel/preset-react"], + "presets": [ + "@babel/preset-env", + ["@babel/preset-react", {"runtime": "automatic"}] +], "plugins": ["transform-class-properties"] } \ No newline at end of file diff --git a/package.json b/package.json index f512a27..8b7e7cf 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "dev": "webpack --mode development --watch ./leadmanager/frontend/src/index.js --output ./leadmanager/frontend/static/frontend/main.js", - "build": "webpack --mode production ./leadmanager/frontend/src/index.js --output ./leadmanager/frontend/static/frontend/main.js" + "dev": "webpack --config webpack.config.js --mode=development --watch", + "build": "webpack --config webpack.config.js --mode=production" }, "keywords": [], "author": "", diff --git a/webpack.config.js b/webpack.config.js index 18b7faf..bdb67e9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,11 @@ +var path = require("path") + module.exports = { + entry: path.join(__dirname, "leadmanager/frontend/src/index"), + output: { + path: path.join(__dirname, "leadmanager/frontend/static/frontend"), + filename: "[name].js", + }, module: { rules: [ {