🚀 esbuild system
this removes the watch command but build speeds
This commit is contained in:
parent
130ba380c7
commit
8549cfdd9e
3 changed files with 1221 additions and 2709 deletions
35
build.js
Normal file
35
build.js
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { rimraf } from 'rimraf';
|
||||||
|
import { copyFile, mkdir, readFile } from 'node:fs/promises';
|
||||||
|
import { build } from 'esbuild';
|
||||||
|
|
||||||
|
// read version from package.json
|
||||||
|
const pkg = JSON.parse(await readFile('package.json'));
|
||||||
|
process.env.ULTRAVIOLET_VERSION = pkg.version;
|
||||||
|
|
||||||
|
const isDevelopment = process.argv.includes('--dev');
|
||||||
|
|
||||||
|
await rimraf('dist');
|
||||||
|
await mkdir('dist');
|
||||||
|
|
||||||
|
// don't compile these files
|
||||||
|
await copyFile('src/sw.js', 'dist/sw.js');
|
||||||
|
await copyFile('src/uv.config.js', 'dist/uv.config.js');
|
||||||
|
|
||||||
|
await build({
|
||||||
|
platform: 'browser',
|
||||||
|
sourcemap: true,
|
||||||
|
minify: !isDevelopment,
|
||||||
|
entryPoints: {
|
||||||
|
'uv.bundle': './src/rewrite/index.js',
|
||||||
|
'uv.client': './src/client/index.js',
|
||||||
|
'uv.handler': './src/uv.handler.js',
|
||||||
|
'uv.sw': './src/uv.sw.js',
|
||||||
|
},
|
||||||
|
define: {
|
||||||
|
'process.env.ULTRAVIOLET_VERSION': JSON.stringify(
|
||||||
|
process.env.ULTRAVIOLET_VERSION
|
||||||
|
),
|
||||||
|
},
|
||||||
|
bundle: true,
|
||||||
|
outdir: 'dist/',
|
||||||
|
});
|
||||||
3875
package-lock.json
generated
3875
package-lock.json
generated
File diff suppressed because it is too large
Load diff
16
package.json
16
package.json
|
|
@ -16,17 +16,14 @@
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "cross-env NODE_ENV=production webpack-cli",
|
"build": "node build.js",
|
||||||
"dev": "cross-env NODE_ENV=development webpack-cli",
|
"dev": "node build.js --dev"
|
||||||
"watch": "cross-env NODE_ENV=development webpack-cli --watch"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tomphttp/bare-client": "^2.0.1",
|
"@tomphttp/bare-client": "^2.0.1",
|
||||||
"copy-webpack-plugin": "^11.0.0",
|
|
||||||
"cross-env": "^7.0.3",
|
|
||||||
"css-tree": "^2.3.1",
|
"css-tree": "^2.3.1",
|
||||||
|
"esbuild": "^0.18.11",
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.28.0",
|
||||||
"eslint-webpack-plugin": "^3.2.0",
|
|
||||||
"esotope-hammerhead": "^0.6.4",
|
"esotope-hammerhead": "^0.6.4",
|
||||||
"events": "^3.3.0",
|
"events": "^3.3.0",
|
||||||
"idb": "^7.1.1",
|
"idb": "^7.1.1",
|
||||||
|
|
@ -34,10 +31,7 @@
|
||||||
"mime-db": "^1.52.0",
|
"mime-db": "^1.52.0",
|
||||||
"parse5": "^7.1.2",
|
"parse5": "^7.1.2",
|
||||||
"prettier": "^2.8.0",
|
"prettier": "^2.8.0",
|
||||||
"set-cookie-parser": "^2.6.0",
|
"rimraf": "^5.0.1",
|
||||||
"source-map-loader": "^4.0.1",
|
"set-cookie-parser": "^2.6.0"
|
||||||
"terser-webpack-plugin": "^5.3.6",
|
|
||||||
"webpack": "^5.75.0",
|
|
||||||
"webpack-cli": "^5.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue