Skip to content

Latest commit

 

History

History
92 lines (75 loc) · 2.01 KB

quick-start.md

File metadata and controls

92 lines (75 loc) · 2.01 KB

Quick start

Prerequisites: Node.js

git clone https://github.com/Tanimodori/viteburner-template.git
cd viteburner-template
npm i
npm run dev

In bitburner, select "Options > Remote API", enter the port of viteburner displays (default: 12525) and click "Connect".

Migrate your existing project to viteburner

  1. Install devDependencies
npm i -D viteburner vite
  1. (a) Sync-only setup

In vite.config.js

/* eslint-env node */
import { defineConfig } from 'viteburner';
import { resolve } from 'path';
export default defineConfig({
  /** basic vite configs */
  resolve: {
    alias: {
      /** path to your source code */
      '@': resolve(__dirname, 'src'),
      '/src': resolve(__dirname, 'src'),
    },
  },
  build: { minify: false },
  /** viteburner configs */
  viteburner: {
    watch: [{ pattern: 'src/**/*.{js,script,txt}' }],
  },
});

Note: The config shown above includes basic vite configs. If your project doesn't have an existing vite.config.js/vite.config.ts, you may add them into the config. Otherwise you can just add viteburner-specific configs only. You can find more configs in vite docs.

  1. (b) TS or mixed TS+JS setup

In vite.config.ts

/* eslint-env node */
import { defineConfig } from 'viteburner';
import { resolve } from 'path';
export default defineConfig({
  /** basic vite configs */
  resolve: {
    alias: {
      /** path to your source code */
      '@': resolve(__dirname, 'src'),
      '/src': resolve(__dirname, 'src'),
    },
  },
  build: { minify: false },
  /** viteburner configs */
  viteburner: {
    watch: [
      {
        pattern: 'src/**/*.{js,ts}',
        transform: true,
      },
      { pattern: 'src/**/*.{script,txt}' },
    ],
  },
});
  1. configure package.json
{
  "scripts": {
    "dev": "viteburner"
  }
}
  1. npm run dev in your terminal to start viteburner.