Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kameshwaran
authored and
Kameshwaran
committed
Jun 19, 2018
1 parent
540066d
commit 3791761
Showing
10 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["env", "react"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist/ | ||
node_modules/ | ||
webpack.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}); |