This project was created in order that it can be used for different projects, personal, business, you can give it the use you want.
To start clone the project and use:
To start the server in your browser:
To create your production files:
This template already has installed what is necessary to be able to be used in its entirety
ReactJS and ReactDOM
JSX | JS
CSS | SASS
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
/** @type {import('webpack').Configuration} */
module.exports = {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "../dist"),
filename: "[name].[contenthash].js",
publicPath: "",
},
module: {
rules: [
{
use: "babel-loader",
test: /\.(js|jsx)$/,
exclude: /node_modules/,
},
{
type: "asset",
test: /\.(png|svg|jpg|jpeg|gif)$/i,
},
],
},
resolve: {
extensions: [".js", ".json", ".jsx"],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: "./public/index.html",
}),
],
};
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
/** @type {import('webpack').Configuration} */
const prodConfig = {
mode: "production",
devtool: "source-map",
module: {
rules: [
{
test: /\.(css|scss|sass)$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
},
],
},
optimization: {
splitChunks: {
chunks: "all",
name: false,
},
},
plugins: [new MiniCssExtractPlugin()],
};
module.exports = merge(common, prodConfig);
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
/** @type {import('webpack').Configuration} */
const devConfig = {
mode: "development",
devServer: {
port: 3000,
contentBase: "../dist",
open: "brave",
},
target: "web",
devtool: "eval-source-map",
module: {
rules: [
{
test: /\.(css|scss|sass)$/,
use: ["style-loader", "css-loader", "sass-loader"],
}
]
}
};
module.exports = merge(common, devConfig);
If you have knowledge of webpack you can modify the exit route to your liking
As explained above, this project has many purposes and if you want to use them in your projects, do not hesitate to do so.