Skip to content

Instantly share code, notes, and snippets.

@nickserv
Last active June 20, 2022 21:38
Show Gist options
  • Save nickserv/80c1540b752c4df421305be51251558a to your computer and use it in GitHub Desktop.
Save nickserv/80c1540b752c4df421305be51251558a to your computer and use it in GitHub Desktop.
Simple Vite-like app template for esbuild
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="https://esbuild.github.io/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>esbuild App</title>
<link rel="stylesheet" href="/dist/main.css">
</head>
<body>
<div id="app"></div>
<script type="module" src="/dist/main.js"></script>
</body>
</html>
import './style.css'
document.querySelector('#app').innerHTML = `
<h1>Hello esbuild!</h1>
<a href="https://esbuild.github.io/" target="_blank">Documentation</a>
`
{
"name": "esbuild-app",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "yarn build --servedir=.",
"build": "esbuild ./main --bundle --outdir=dist",
"preview": "serve"
},
"dependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"esbuild": "^0.14.46",
"serve": "^13.0.2"
}
}
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment