Skip to content

Commit

Permalink
Working boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
Kameshwaran authored and Kameshwaran committed Jun 19, 2018
1 parent 540066d commit 3791761
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
@@ -0,0 +1,3 @@
{
"presets": ["env", "react"]
}
3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
dist/
node_modules/
webpack.config.js
18 changes: 18 additions & 0 deletions .eslintrc
@@ -0,0 +1,18 @@
{
"parser": "babel-eslint",
"extends": "airbnb",
"rules": {
"react/jsx-filename-extension": 0
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"react"
],
"env": {
"browser": true
}
}
Empty file removed components/index.js
Empty file.
Empty file removed index.js
Empty file.
5 changes: 5 additions & 0 deletions package.json
Expand Up @@ -3,6 +3,11 @@
"version": "1.0.0",
"description": "A set of React UI components",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development --open --hot",
"build": "webpack --mode production --config webpack.prod.js",
"lint": "eslint ./ --ext .jsx --ext .js"
},
"repository": "https://github.com/Codebrahma/React-Lite-UI.git",
"license": "ISC",
"private": false,
Expand Down
12 changes: 12 additions & 0 deletions src/index.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>React and Webpack4</title>
</head>
<body>
<section id="index"></section>
</body>
</html>
10 changes: 10 additions & 0 deletions src/index.js
@@ -0,0 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';

const Index = () => (
<div>
Hello React!
</div>
);

ReactDOM.render(<Index />, document.getElementById('index'));
53 changes: 53 additions & 0 deletions webpack.common.js
@@ -0,0 +1,53 @@
const HtmlWebPackPlugin = require("html-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

const devMode = process.env.NODE_ENV !== 'production';
const htmlWebpackPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
});

module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.jsx$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader"
]
},
{
test: /\.s?[ac]ss$/,
use: [
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
},
]
},
plugins: [
htmlWebpackPlugin,
//new BundleAnalyzerPlugin(),
new MiniCssExtractPlugin({
filename: devMode ? '[name].css' : '[name].[hash].css',
chunkFilename: devMode ? '[id].css' : '[id].[hash].css',
})
]
};
7 changes: 7 additions & 0 deletions webpack.config.js
@@ -0,0 +1,7 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
devtool: 'inline-source-map',
mode: 'development',
});

0 comments on commit 3791761

Please sign in to comment.