mirror of
https://github.com/aljazceru/nostr-relay-registry.git
synced 2025-12-17 06:04:24 +01:00
remove webpack, use esbuild instead.
this probably breaks docker. @cameri help.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,5 +1,4 @@
|
||||
yarn.lock
|
||||
node_modules
|
||||
*.wasm
|
||||
out.js
|
||||
dist
|
||||
public/main.js
|
||||
|
||||
@@ -2,13 +2,13 @@ FROM node:14-alpine as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY index.html main.js package.json webpack.config.js /app/
|
||||
COPY index.html main.js package.json build.js /app/
|
||||
|
||||
RUN yarn \
|
||||
&& npm run build
|
||||
&& yarn run build
|
||||
|
||||
FROM nginx:stable-alpine as nginx-nostr-relay-registry
|
||||
|
||||
COPY ./nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
COPY --from=build /app/dist /app
|
||||
COPY --from=build /app/public /app
|
||||
|
||||
26
build.js
Executable file
26
build.js
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const esbuild = require('esbuild')
|
||||
const alias = require('esbuild-plugin-alias')
|
||||
const nodeGlobals = require('@esbuild-plugins/node-globals-polyfill').default
|
||||
|
||||
const prod = process.argv.indexOf('prod') !== -1
|
||||
|
||||
esbuild
|
||||
.build({
|
||||
bundle: true,
|
||||
entryPoints: ['main.js'],
|
||||
outdir: 'public',
|
||||
plugins: [
|
||||
alias({
|
||||
stream: require.resolve('readable-stream')
|
||||
}),
|
||||
nodeGlobals({buffer: true})
|
||||
],
|
||||
sourcemap: prod ? false : 'inline',
|
||||
define: {
|
||||
window: 'self',
|
||||
global: 'self'
|
||||
}
|
||||
})
|
||||
.then(() => console.log('build success.'))
|
||||
@@ -1,10 +1,6 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /app;
|
||||
include mime.types;
|
||||
types {
|
||||
application/wasm wasm;
|
||||
}
|
||||
root /app/public;
|
||||
|
||||
location / {
|
||||
index index.html;
|
||||
|
||||
14
package.json
14
package.json
@@ -1,15 +1,17 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
|
||||
"buffer": "^6.0.3",
|
||||
"nostr-tools": "^0.12.4",
|
||||
"esbuild": "^0.14.21",
|
||||
"esbuild-plugin-alias": "^0.2.1",
|
||||
"events": "^3.3.0",
|
||||
"nostr-tools": "^0.22.1",
|
||||
"readable-stream": "^3.6.0",
|
||||
"vue": "3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webpack": "^5.65.0",
|
||||
"webpack-cli": "^4.9.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"build": "mkdir -p dist/ && cp index.html dist/ && webpack"
|
||||
"build": "./build.js prod",
|
||||
"watch": "ag -l --js | entr ./build.js"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
|
||||
<div id="app" style="font-family: monospace"></div>
|
||||
|
||||
<script src="out.js"></script>
|
||||
<script src="main.js"></script>
|
||||
@@ -1,22 +0,0 @@
|
||||
const path = require('path')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: './main.js',
|
||||
output: {
|
||||
path: `${__dirname}/dist`,
|
||||
filename: 'out.js'
|
||||
},
|
||||
experiments: {asyncWebAssembly: true},
|
||||
resolve: {
|
||||
alias: {
|
||||
stream: 'readable-stream'
|
||||
},
|
||||
fallback: {
|
||||
buffer: 'buffer/index.js',
|
||||
stream: 'readable-stream/readable.js',
|
||||
crypto: false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user