Home / Function/ preventNodeBuiltinDependencyPlugin() — astro Function Reference

preventNodeBuiltinDependencyPlugin() — astro Function Reference

Architecture documentation for the preventNodeBuiltinDependencyPlugin() function in test-plugins.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b3e723b6_89ee_5b2f_45ce_2c99606d46d1["preventNodeBuiltinDependencyPlugin()"]
  3d360664_2e29_48cd_8f31_7a5358be685d["test-plugins.js"]
  b3e723b6_89ee_5b2f_45ce_2c99606d46d1 -->|defined in| 3d360664_2e29_48cd_8f31_7a5358be685d
  style b3e723b6_89ee_5b2f_45ce_2c99606d46d1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/test-plugins.js lines 1–16

export function preventNodeBuiltinDependencyPlugin() {
	// Verifies that `astro:content` does not have a hard dependency on Node builtins.
	// This is to verify it will run on Cloudflare and Deno
	return {
		name: 'verify-no-node-stuff',
		generateBundle() {
			const nodeModules = ['node:fs', 'node:url', 'node:worker_threads', 'node:path'];
			nodeModules.forEach((name) => {
				const mod = this.getModuleInfo(name);
				if (mod) {
					throw new Error(`Node builtins snuck in: ${name}`);
				}
			});
		},
	};
}

Subdomains

Frequently Asked Questions

What does preventNodeBuiltinDependencyPlugin() do?
preventNodeBuiltinDependencyPlugin() is a function in the astro codebase, defined in packages/astro/test/test-plugins.js.
Where is preventNodeBuiltinDependencyPlugin() defined?
preventNodeBuiltinDependencyPlugin() is defined in packages/astro/test/test-plugins.js at line 1.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free