Skip to content

script-utils/bundlers/esbuild-impl/preprocess-plugin

This module defines a custom esbuild plugin that preprocesses JavaScript and TypeScript files.

@remarks We cannot use . instead of (dot) in the above description because the file itself is preprocessed with the same rule.

FunctionDescription
preprocessPluginCreates an esbuild plugin that preprocesses JavaScript and TypeScript files. This plugin performs the following tasks: - Replaces instances of import(dot)meta(dot)url with a Node.js-compatible __filename alternative. - Modifies the sourceMappingURL comment to ensure compatibility with Obsidian’s plugin system. - Adds a basic process object to the global scope if process is referenced but not defined.