File tree Expand file tree Collapse file tree 10 files changed +111
-0
lines changed Expand file tree Collapse file tree 10 files changed +111
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "presets" : [" env" , " react" ]
3
+ }
Original file line number Diff line number Diff line change
1
+ dist /
2
+ node_modules /
3
+ webpack.config.js
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 3
3
"version" : " 1.0.0" ,
4
4
"description" : " A set of React UI components" ,
5
5
"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
+ },
6
11
"repository" : " https://github.com/Codebrahma/React-Lite-UI.git" ,
7
12
"license" : " ISC" ,
8
13
"private" : false ,
Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change
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' ) ) ;
Original file line number Diff line number Diff line change
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 : / \. j s $ / ,
16
+ exclude : / n o d e _ m o d u l e s / ,
17
+ use : {
18
+ loader : "babel-loader"
19
+ }
20
+ } ,
21
+ {
22
+ test : / \. j s x $ / ,
23
+ exclude : / n o d e _ m o d u l e s / ,
24
+ use : {
25
+ loader : "babel-loader"
26
+ }
27
+ } ,
28
+ {
29
+ test : / \. c s s $ / ,
30
+ use : [
31
+ MiniCssExtractPlugin . loader ,
32
+ "css-loader"
33
+ ]
34
+ } ,
35
+ {
36
+ test : / \. s ? [ a c ] s s $ / ,
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
+ } ;
Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments