Skip to content

Instantly share code, notes, and snippets.

@kytiken
Last active May 25, 2020 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kytiken/b556b9a987963aae363aca6f6e3f60fa to your computer and use it in GitHub Desktop.
Save kytiken/b556b9a987963aae363aca6f6e3f60fa to your computer and use it in GitHub Desktop.
instant react environment with parcel

Instant react environment

  1. clone

    git clone git@gist.github.com:b556b9a987963aae363aca6f6e3f60fa.git
    
  2. npm install

    sudo docker-compose run -u (id -u $USER):(id -g $USER) app npm install
    
  3. docker-compose up

    sudo docker-compose up
    
  4. open page

    http://localhost:1234/

version: '3'
services:
app:
image: node
volumes:
- .:/app
working_dir: /app
ports:
- 1234:1234
command: npx parcel index.html
<html>
<body>
<div id="root"></div>
<script src="./index.js"></script>
</body>
</html>
import ReactDOM from 'react-dom'
import React from 'react'
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"devDependencies": {
"parcel": "^1.12.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment