Repository: rwieruch/advanced-react-webpack-babel-setup
Branch: master
Commit: 9ffa4811463b
Files: 17
Total size: 7.4 KB
Directory structure:
gitextract_xu0pk7sc/
├── .babelrc
├── .eslintrc
├── .github/
│ └── FUNDING.yml
├── .gitignore
├── .prettierrc
├── .travis.yml
├── README.md
├── build-utils/
│ ├── addons/
│ │ └── webpack.bundleanalyze.js
│ ├── webpack.common.js
│ ├── webpack.config.js
│ ├── webpack.dev.js
│ └── webpack.prod.js
├── package.json
├── sandbox.config.json
└── src/
├── App.js
├── index.html
└── index.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
================================================
FILE: .eslintrc
================================================
{
"parser": "babel-eslint",
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": ["airbnb", "prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": ["error"],
"import/no-extraneous-dependencies": 0,
"react/jsx-filename-extension": 0
}
}
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: rwieruch
patreon: # rwieruch
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with a single custom sponsorship URL
================================================
FILE: .gitignore
================================================
dist/*
node_modules/*
================================================
FILE: .prettierrc
================================================
{
"singleQuote": true,
"printWidth": 70
}
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- stable
install:
- npm install
script:
- npm test
================================================
FILE: README.md
================================================
# advanced-react-webpack-babel-setup
[](https://travis-ci.org/rwieruch/advanced-react-webpack-babel-setup) [](https://greenkeeper.io/)
Advanced React with Webpack Setup. How to set it up yourself:
- [Minimal React + Webpack Setup](https://www.robinwieruch.de/minimal-react-webpack-babel-setup/)
- [Advanced Webpack Setup](https://www.robinwieruch.de/webpack-advanced-setup-tutorial/)
- [ESLint](https://www.robinwieruch.de/webpack-eslint/) + [ESLint + React](https://www.robinwieruch.de/react-eslint-webpack-babel/) + [Prettier + ESLint](https://www.robinwieruch.de/prettier-eslint/)
[](https://codesandbox.io/s/github/rwieruch/advanced-react-webpack-babel-setup/tree/master/?fontsize=14)
## Features
- React 16
- Webpack 5
- Babel 7
- Hot Module Replacement
- Dev + Production Builds
- Dist Folder Managagement by Webpack
- Common and environment specific Webpack Configuration
- Composition of Webpack Configuration
- Source Maps
- Environment Variables
- Webpack Add-Ons
- ESLint + Prettier
## DIY Add-Ons
- [SVG Icons](https://www.robinwieruch.de/react-svg-icon-components/)
- [CSS Modules](https://www.robinwieruch.de/react-css-modules/)
- [Fonts Support](https://www.robinwieruch.de/webpack-font/)
- [Images Support](https://www.robinwieruch.de/webpack-images/)
- [Docker](https://www.robinwieruch.de/docker-react-development)
## Alternatives
- [Minimal React Webpack Babel Setup](https://github.com/rwieruch/minimal-react-webpack-babel-setup)
## Installation
- `git clone git@github.com:rwieruch/advanced-react-webpack-babel-setup.git`
- cd advanced-react-webpack-babel-setup
- npm install
- npm start
- visit `http://localhost:8080/`
================================================
FILE: build-utils/addons/webpack.bundleanalyze.js
================================================
const path = require('path');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
module.exports = {
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: path.resolve(
__dirname,
'..',
'..',
'./dist/report.html'
),
openAnalyzer: false,
}),
],
};
================================================
FILE: build-utils/webpack.common.js
================================================
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, '..', './src/index.js'),
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader'],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx'],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Advanced React with Webpack Setup',
template: path.resolve(__dirname, '..', './src/index.html'),
}),
],
output: {
path: path.resolve(__dirname, '..', 'dist'),
filename: 'bundle.js',
},
};
================================================
FILE: build-utils/webpack.config.js
================================================
/* eslint-disable global-require */
/* eslint-disable import/no-dynamic-require */
const { merge } = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const getAddons = (addonsArgs) => {
const addons = Array.isArray(addonsArgs)
? addonsArgs
: [addonsArgs];
return addons
.filter(Boolean)
.map((name) => require(`./addons/webpack.${name}.js`));
};
module.exports = ({ env, addon }) => {
const envConfig = require(`./webpack.${env}.js`);
return merge(commonConfig, envConfig, ...getAddons(addon));
};
================================================
FILE: build-utils/webpack.dev.js
================================================
const path = require('path');
const webpack = require('webpack');
const Dotenv = require('dotenv-webpack');
module.exports = {
mode: 'development',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new Dotenv({
path: path.resolve(__dirname, '..', './.env.development'),
}),
],
devServer: {
contentBase: path.resolve(__dirname, '..', './dist'),
hot: true,
},
devtool: 'eval-source-map',
};
================================================
FILE: build-utils/webpack.prod.js
================================================
const path = require('path');
const Dotenv = require('dotenv-webpack');
module.exports = {
mode: 'production',
plugins: [
new Dotenv({
path: path.resolve(__dirname, '..', './.env.production'),
}),
],
devServer: {
contentBase: path.resolve(__dirname, '..', './dist'),
},
devtool: 'source-map',
};
================================================
FILE: package.json
================================================
{
"name": "advanced-react-webpack-babel-setup",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack serve --config build-utils/webpack.config.js --env env=dev",
"build": "webpack --config build-utils/webpack.config.js --env env=prod",
"build:analyze": "npm run build -- --env addon=bundleanalyze",
"test": "echo \"Error: no test specified\" && exit 0"
},
"keywords": [],
"author": "Robin Wieruch <opensource@rwieruch.com> (https://www.robinwieruch.de)",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"dotenv-webpack": "^5.0.0",
"eslint": "^7.12.1",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.15.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
"html-webpack-plugin": "^4.5.0",
"prettier": "^2.1.2",
"react-hot-loader": "^4.13.0",
"webpack": "^5.3.2",
"webpack-bundle-analyzer": "^3.9.0",
"webpack-cli": "^4.1.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.3.0"
},
"dependencies": {
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
}
================================================
FILE: sandbox.config.json
================================================
{
"template": "node"
}
================================================
FILE: src/App.js
================================================
import React from 'react';
import PropTypes from 'prop-types';
const App = ({ title }) => <div>{title}</div>;
App.propTypes = {
title: PropTypes.string.isRequired,
};
export default App;
================================================
FILE: src/index.html
================================================
<!DOCTYPE html>
<html>
<head>
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="app"></div>
</body>
</html>
================================================
FILE: src/index.js
================================================
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
const title = 'React with Webpack and Babel';
ReactDOM.render(
<App title={title} />,
document.getElementById('app')
);
module.hot.accept();
gitextract_xu0pk7sc/
├── .babelrc
├── .eslintrc
├── .github/
│ └── FUNDING.yml
├── .gitignore
├── .prettierrc
├── .travis.yml
├── README.md
├── build-utils/
│ ├── addons/
│ │ └── webpack.bundleanalyze.js
│ ├── webpack.common.js
│ ├── webpack.config.js
│ ├── webpack.dev.js
│ └── webpack.prod.js
├── package.json
├── sandbox.config.json
└── src/
├── App.js
├── index.html
└── index.js
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (9K chars).
[
{
"path": ".babelrc",
"chars": 62,
"preview": "{\n \"presets\": [\"@babel/preset-env\", \"@babel/preset-react\"]\n}\n"
},
{
"path": ".eslintrc",
"chars": 302,
"preview": "{\n \"parser\": \"babel-eslint\",\n \"env\": {\n \"browser\": true,\n \"es6\": true,\n \"node\": true\n },\n \"extends\": [\"airb"
},
{
"path": ".github/FUNDING.yml",
"chars": 587,
"preview": "# These are supported funding model platforms\n\ngithub: rwieruch\npatreon: # rwieruch\nopen_collective: # Replace with a si"
},
{
"path": ".gitignore",
"chars": 21,
"preview": "dist/*\nnode_modules/*"
},
{
"path": ".prettierrc",
"chars": 45,
"preview": "{\n \"singleQuote\": true,\n \"printWidth\": 70\n}"
},
{
"path": ".travis.yml",
"chars": 86,
"preview": "language: node_js\n\nnode_js:\n - stable\n\ninstall:\n - npm install\n\nscript:\n - npm test"
},
{
"path": "README.md",
"chars": 1951,
"preview": "# advanced-react-webpack-babel-setup\n\n[;\nconst { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');\n\nmodule.exports = {\n "
},
{
"path": "build-utils/webpack.common.js",
"chars": 747,
"preview": "const path = require('path');\nconst { CleanWebpackPlugin } = require('clean-webpack-plugin');\nconst HtmlWebpackPlugin = "
},
{
"path": "build-utils/webpack.config.js",
"chars": 558,
"preview": "/* eslint-disable global-require */\n/* eslint-disable import/no-dynamic-require */\n\nconst { merge } = require('webpack-m"
},
{
"path": "build-utils/webpack.dev.js",
"chars": 431,
"preview": "const path = require('path');\nconst webpack = require('webpack');\nconst Dotenv = require('dotenv-webpack');\n\nmodule.expo"
},
{
"path": "build-utils/webpack.prod.js",
"chars": 327,
"preview": "const path = require('path');\nconst Dotenv = require('dotenv-webpack');\n\nmodule.exports = {\n mode: 'production',\n plug"
},
{
"path": "package.json",
"chars": 1466,
"preview": "{\n \"name\": \"advanced-react-webpack-babel-setup\",\n \"version\": \"1.0.0\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"sc"
},
{
"path": "sandbox.config.json",
"chars": 26,
"preview": "\n{\n \"template\": \"node\"\n}\n"
},
{
"path": "src/App.js",
"chars": 192,
"preview": "import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst App = ({ title }) => <div>{title}</div>;\n\nApp.prop"
},
{
"path": "src/index.html",
"chars": 152,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <title><%= htmlWebpackPlugin.options.title %></title>\n </head>\n <body>\n <div id"
},
{
"path": "src/index.js",
"chars": 235,
"preview": "import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport App from './App';\n\nconst title = 'React with Webpac"
}
]
About this extraction
This page contains the full source code of the rwieruch/advanced-react-webpack-babel-setup GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (7.4 KB), approximately 2.5k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.