feat(wp-js): initial commit

This commit is contained in:
dancingCycle 2022-06-07 09:42:58 +02:00
parent 640b2fdff3
commit 63c89e072a
7 changed files with 171 additions and 1 deletions

View File

@ -12,4 +12,5 @@ This is a sandbox for projects using react.js.
* [fare-zones-table](./fare-zones-table)
* [login-auth](./login-auth)
* [pages](./pages)
* [webpack-react](./webpack-react)
* [webpack for vanilla JavaScript](./webpack-js)
* [webpack for react with vanilla JavaScript](./wp-react)

108
wp-js/.gitignore vendored Normal file
View File

@ -0,0 +1,108 @@
# Others
package-lock.json
build*
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port

11
wp-js/README.md Normal file
View File

@ -0,0 +1,11 @@
# webpack-js
## Table of Contents
0. [General](#general)
1. [Links](#links)
# General
# Links
* [React setup with webpack for beginners](https://dev.to/deepanjangh/react-setup-with-webpack-for-beginners-2a8k)

24
wp-js/package.json Normal file
View File

@ -0,0 +1,24 @@
{
"private": true,
"name": "webpack-js",
"description": "example using webpack for vanilla JavaScript",
"version": "0.0.1",
"main": "index.js",
"keywords": [
"react",
"webpack"
],
"author": "Software Ingenieur Begerad <dialog@SwIngBe.de>",
"license": "GPL-3.0-or-later",
"engines": {
"node": ">=10"
},
"scripts": {
"start": "webpack serve --config ./webpack.config.js --mode development"
},
"devDependencies": {
"webpack": "^5.73.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.2"
}
}

13
wp-js/public/index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>React with webpack</title>
</head>
<body>
<div>
<h1>Hello Webpack</h1>
</div>
<script src="./bundle.js"></script>
</body>
</html>

1
wp-js/src/index.js Normal file
View File

@ -0,0 +1 @@
console.log("Hello World")

12
wp-js/webpack.config.js Normal file
View File

@ -0,0 +1,12 @@
//path is used to resolve properly across the OS
const path = require('path');
module.exports = {
//bundle *.js from this entry point
entry: path.resolve(__dirname, './src/index.js'),
//create output file to be linked to index.html
output: {
path: path.resolve(__dirname, './public'),
filename: 'bundle.js',
},
};