webpack example (#1240)

This commit is contained in:
Bradley Matusiak 2022-05-24 17:08:18 -04:00 committed by GitHub
parent 210a5834c6
commit c85cb4365d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 0 deletions

3
examples/webpack/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
package-lock.json
node_modules
public

View File

@ -0,0 +1,17 @@
{
"name": "webpack",
"version": "1.0.0",
"description": "webpack build example",
"scripts": {
"build": "webpack --devtool source-map --config webpack.config.js",
"prepare": "npm run build"
},
"author": "",
"license": "ISC",
"dependencies": {
"gun": "github:amark/gun",
"html-webpack-plugin": "^5.5.0",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2"
}
}

View File

@ -0,0 +1,9 @@
define(function(require, exports, module) {
var Gun = require("gun");
var gun = new Gun();
gun.get("hello").get("world").put("from gun").on((data, key) => console.log(data, key));
});

View File

@ -0,0 +1,5 @@
<!DOCTYPE html>
<html>
<head></head>
<body></body>
</html>

View File

@ -0,0 +1,35 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
let plugins = [];
plugins.push(new HtmlWebpackPlugin({
filename: './index.html',
template: './src/index.html',
inject: true,
minify: false,
hash: false,
cache: false,
showErrors: false
}));
console.log("webpack config loaded");
module.exports = {
mode: "development",
// stats: 'minimal',
stats: 'normal',
// stats: 'verbose',
entry: [path.resolve(__dirname, './src/app.js')],
output: {
path: path.resolve(__dirname, './public'),
clean: true,
filename: './app.js'
},
plugins: plugins
};