Skip to content

Commit 3791761

Browse files
KameshwaranKameshwaran
authored andcommitted
Working boilerplate
1 parent 540066d commit 3791761

File tree

10 files changed

+111
-0
lines changed

10 files changed

+111
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["env", "react"]
3+
}

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
webpack.config.js

.eslintrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "airbnb",
4+
"rules": {
5+
"react/jsx-filename-extension": 0
6+
},
7+
"parserOptions": {
8+
"ecmaFeatures": {
9+
"jsx": true
10+
}
11+
},
12+
"plugins": [
13+
"react"
14+
],
15+
"env": {
16+
"browser": true
17+
}
18+
}

components/index.js

Whitespace-only changes.

index.js

Whitespace-only changes.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
"version": "1.0.0",
44
"description": "A set of React UI components",
55
"main": "index.js",
6+
"scripts": {
7+
"start": "webpack-dev-server --mode development --open --hot",
8+
"build": "webpack --mode production --config webpack.prod.js",
9+
"lint": "eslint ./ --ext .jsx --ext .js"
10+
},
611
"repository": "https://github.com/Codebrahma/React-Lite-UI.git",
712
"license": "ISC",
813
"private": false,

src/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>React and Webpack4</title>
8+
</head>
9+
<body>
10+
<section id="index"></section>
11+
</body>
12+
</html>

src/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
const Index = () => (
5+
<div>
6+
Hello React!
7+
</div>
8+
);
9+
10+
ReactDOM.render(<Index />, document.getElementById('index'));

webpack.common.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const HtmlWebPackPlugin = require("html-webpack-plugin");
2+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
3+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
4+
5+
const devMode = process.env.NODE_ENV !== 'production';
6+
const htmlWebpackPlugin = new HtmlWebPackPlugin({
7+
template: "./src/index.html",
8+
filename: "./index.html"
9+
});
10+
11+
module.exports = {
12+
module: {
13+
rules: [
14+
{
15+
test: /\.js$/,
16+
exclude: /node_modules/,
17+
use: {
18+
loader: "babel-loader"
19+
}
20+
},
21+
{
22+
test: /\.jsx$/,
23+
exclude: /node_modules/,
24+
use: {
25+
loader: "babel-loader"
26+
}
27+
},
28+
{
29+
test: /\.css$/,
30+
use: [
31+
MiniCssExtractPlugin.loader,
32+
"css-loader"
33+
]
34+
},
35+
{
36+
test: /\.s?[ac]ss$/,
37+
use: [
38+
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
39+
'css-loader',
40+
'sass-loader',
41+
],
42+
},
43+
]
44+
},
45+
plugins: [
46+
htmlWebpackPlugin,
47+
//new BundleAnalyzerPlugin(),
48+
new MiniCssExtractPlugin({
49+
filename: devMode ? '[name].css' : '[name].[hash].css',
50+
chunkFilename: devMode ? '[id].css' : '[id].[hash].css',
51+
})
52+
]
53+
};

webpack.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const merge = require('webpack-merge');
2+
const common = require('./webpack.common.js');
3+
4+
module.exports = merge(common, {
5+
devtool: 'inline-source-map',
6+
mode: 'development',
7+
});

0 commit comments

Comments
 (0)