update build.mjs
This commit is contained in:
21
build.mjs
21
build.mjs
@@ -2,24 +2,17 @@ import { context } from 'esbuild';
|
||||
import { glob } from 'glob';
|
||||
import {BitburnerPlugin} from 'esbuild-bitburner-plugin';
|
||||
|
||||
const WATCH = process.argv.includes('--watch');
|
||||
|
||||
const ctx = await context({
|
||||
entryPoints: await glob('./servers/**/*.{js,jsx,ts,tsx}'),
|
||||
bundle: true,
|
||||
plugins: [BitburnerPlugin()],
|
||||
write: false,
|
||||
outbase: "./servers",
|
||||
minify: !WATCH,
|
||||
outdir: "./dist",
|
||||
plugins: [BitburnerPlugin({
|
||||
port: 12525
|
||||
})],
|
||||
bundle: true,
|
||||
format: 'esm',
|
||||
platform: 'node',
|
||||
define: WATCH ? undefined : {
|
||||
'process.env.NODE_ENV': "'production'",
|
||||
},
|
||||
logLevel: 'info'
|
||||
platform: 'browser',
|
||||
});
|
||||
|
||||
await ctx.rebuild();
|
||||
|
||||
if (WATCH) ctx.watch();
|
||||
else ctx.dispose();
|
||||
ctx.watch();
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
"description": "template for external editors for the game bitburner",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"watch": "node ./build.mjs --watch",
|
||||
"build": "node ./build.mjs"
|
||||
"start": "node ./build.mjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
3
servers/home/example2.js
Normal file
3
servers/home/example2.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export async function main(ns){
|
||||
ns.tprint('hello world');
|
||||
}
|
||||
Reference in New Issue
Block a user