* web: Prep ESBuild plugin for publish. * prettier-config: Update deps. * eslint-config: Update deps. * docusaurus-config: Update deps. * docs: Update deps. * docs: Enable linter. * docs: Lint. * web/sfe: Clean up types. Prep for monorepo. * esbuild-plugin-live-reload: Update deps. * web: Tidy ESLint, script commands. * web: Fix logs. * web: Lint. * web: Split compile check from cached version.
		
			
				
	
	
		
			41 lines
		
	
	
		
			919 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			919 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
# `@goauthentik/esbuild-plugin-live-reload`
 | 
						|
 | 
						|
_A plugin that enables live reloading of ESBuild during development._
 | 
						|
 | 
						|
## Usage
 | 
						|
 | 
						|
### Node.js setup
 | 
						|
 | 
						|
```js
 | 
						|
import { liveReloadPlugin } from "@goauthentik/esbuild-plugin-live-reload";
 | 
						|
import esbuild from "esbuild";
 | 
						|
 | 
						|
const NodeEnvironment = process.env.NODE_ENV || "development";
 | 
						|
 | 
						|
/**
 | 
						|
 * @type {esbuild.BuildOptions}
 | 
						|
 */
 | 
						|
const buildOptions = {
 | 
						|
    // ... Your build options.
 | 
						|
    define: {
 | 
						|
        "process.env.NODE_ENV": JSON.stringify(NodeEnvironment),
 | 
						|
    },
 | 
						|
    plugins: [liveReloadPlugin(/** @see {@link LiveReloadPluginOptions} */)],
 | 
						|
};
 | 
						|
 | 
						|
const buildContext = await esbuild.context(buildOptions);
 | 
						|
 | 
						|
await buildContext.rebuild();
 | 
						|
await buildContext.watch();
 | 
						|
```
 | 
						|
 | 
						|
### Browser setup
 | 
						|
 | 
						|
```js
 | 
						|
// Place this at the beginning of your application's entry point.
 | 
						|
 | 
						|
if (process.env.NODE_ENV === "development") {
 | 
						|
    await import("@goauthentik/esbuild-plugin-live-reload/client");
 | 
						|
}
 | 
						|
```
 |