Forked from vish448/1-React app without npx create-react-app
Created
April 23, 2022 23:08
-
-
Save abe4x4/6358a099f5d35997f701ec35058eb83c to your computer and use it in GitHub Desktop.
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
## commands from terminal | |
mkdir my-app | |
cd my-app | |
npm init -y -- creates package.json file with default configurations | |
npm install react react-dom -- install react and react-dom dependencies | |
vim .gitignore -- creates gitigonre file | |
mkdir app --create app folder in your project folder | |
cd app | |
touch index.js index.css -- creates two files in app directory | |
npm install --save-dev @babel/core @babel/preset-env @babel/preset-react webpack webpack-cli webpack-dev-server babel-loader css-loader style-loader html-webpack-plugin -- adding all require depnendincies to the project | |
touch webpack.config.js -- creating webpack configurations 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
<!DOCTYPE html> | |
<html> | |
<head><title> | |
my-app | |
</title></head> | |
<body> | |
<div id="app"></div> | |
</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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
class App extends React.Component{ | |
render(){ | |
return( | |
<div>Hello World</div> | |
) | |
} | |
} | |
ReactDOM.render(<App />, document.getElementById('app')) |
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
{ | |
"name": "github-battle", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"babel":{ | |
"presets" : [ | |
"@babel/preset-env", | |
"@babel/preset-react" | |
] | |
}, | |
"scripts": { | |
"start": "webpack-dev-server --open" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"react": "^16.8.6", | |
"react-dom": "^16.8.6" | |
}, | |
"devDependencies": { | |
"@babel/core": "^7.4.3", | |
"@babel/preset-env": "^7.4.3", | |
"@babel/preset-react": "^7.0.0", | |
"babel-loader": "^8.0.5", | |
"css-loader": "^2.1.1", | |
"html-webpack-plugin": "^3.2.0", | |
"style-loader": "^0.23.1", | |
"webpack": "^4.30.0", | |
"webpack-cli": "^3.3.1", | |
"webpack-dev-server": "^3.3.1" | |
} | |
} |
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
var path = require('path'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
entry : './app/index.js', | |
output : { | |
path : path.resolve(__dirname , 'dist'), | |
filename: 'index_bundle.js' | |
}, | |
module : { | |
rules : [ | |
{test : /\.(js)$/, use:'babel-loader'}, | |
{test : /\.css$/, use:['style-loader', 'css-loader']} | |
] | |
}, | |
mode:'development', | |
plugins : [ | |
new HtmlWebpackPlugin ({ | |
template : 'app/index.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
node_modules | |
.DS_Store | |
dist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment