Michael Naumov23k downloadsAllows to do a lot of things with JavaScript/TypeScript scripts from inside the Obsidian itself
formerly known as
Fix Require Modules, see Rebranding section for more details
An Obsidian plugin that lets you write and run modern JavaScript and TypeScript inside Obsidian — in a note, as a command, on a hotkey, at startup — with a rich module system, bringing you the best practices from the modern development ecosystem.
The documentation is an interactive demo vault. Every feature has a note that explains what it does and why you would want it, followed by a button that runs it for real — so you can read the explanation and execute the example in the same place.
Start reading here — it is plain markdown, so it works on GitHub with nothing installed.
A copy of the vault ships with every release. You can access it via any of the following:
CodeScript Toolkit: Open demo vault command.fix-require-modules-demo-vault.zip from the Releases. It unzips into a single fix-require-modules-demo-vault-<version> folder.demo-vault/ in this repository.If you are not sure where to start, three notes cover most of it: Core functions (which of require() / requireAsync() / requireAsyncWrapper() to use), Code buttons (runnable snippets inside a note), and Invocable scripts (turning a script into an Obsidian command).
npm packages, Node built-ins, WebAssembly, ASAR archives and URLs with require() — or await requireAsync(), which also works on mobile.obsidian:// URL.A button in a note that does a job. Put a ```code-button block in your daily note template that moves finished tasks, renames attachments or fills in a property, and click it when you need it. See Code buttons.
A script you run from the command palette or a hotkey. Every script in your scripts folder becomes a command, so a one-off chore becomes a hotkey without writing a plugin. See Invocable scripts and Hotkeys.
A scratch script for the job you will do once. One note holds a throwaway script you rewrite for whatever comes up, and the Run scratch script command runs it without opening the note. See Scratch script.
One helper module shared by every scripting plugin. Write a function once, in TypeScript if you like, and require() it from Dataview, Templater, QuickAdd or CustomJS, instead of pasting a copy into each. See Working with other plugins.
Using an npm package in the vault, such as a date library or a parser. See NPM modules.
Trying out the Obsidian API, or a plugin idea, before building anything. The DevTools console gets the same require() as a button. If your scripts folder holds helpers.ts, open the console (Ctrl/Command + Shift + I) and run:
require('/helpers.ts').summarize(app.workspace.getActiveFile());
The leading / means the scripts folder. See DevTools Console.
| Plugin | Features | How CodeScript Toolkit differs |
|---|---|---|
CustomJS |
Vault JavaScript classes; global object; startup and hotkey scripts | Broader module shapes: TypeScript and ordinary modules; no one-class-per-file requirement |
Execute Code |
Code blocks in 20+ languages; external interpreters | Narrower language scope: JavaScript/TypeScript inside Obsidian, with its API |
JavaScript Init |
One settings-stored JavaScript snippet at startup | Broader entry points: vault-file startup script, buttons, commands, hotkeys and URLs |
JS Engine |
js-engine blocks; Markdown results; view-building API |
Overlaps on in-note code; module system and script entry points beyond blocks |
Modules |
Vault/Internet JavaScript and TypeScript modules; Markdown modules; source maps | Overlaps on module loading; also code buttons, commands, hotkeys and startup scripts |
Plugin REPL |
Evaluates editor lines/selections; inserts results; editor helpers | Alternative execution scope: whole scripts and modules |
RunJS |
Named JavaScript snippets; code list, picker, commands, ribbon and startup | Overlaps on script entry points; also TypeScript compilation and npm packages |
Safe JS |
Isolated Web Workers; permission-gated API; no DOM, Node.js or app access | Alternative trust model: full Obsidian access; no sandbox |
User Plugins |
Vault JavaScript as small plugins; onload instance; commands |
Alternative script shape: ordinary modules; notes and commands as entry points |
Last searched for similar plugins on 2026-10-26.
The plugin is available in the official Community Plugins repository.
On mobile, the plugin runs on the device's own web engine, and it needs a modern one:
Plugin failure: fix-require-modules. Devices that cannot update past iOS 15, such as the iPad mini 4, are not supported.To install the latest beta release of this plugin (regardless if it is available in the official Community Plugins repository or not), follow these steps:
Add plugin button once and wait a few seconds for the plugin to install.By default, debug messages for this plugin are hidden. Its debug namespace is its plugin id, fix-require-modules, not codescript-toolkit: the id kept the plugin's old name (see Rebranding). To show the messages, run this in the DevTools console:
window.DEBUG.enable('fix-require-modules');
The debugging guide explains how to narrow or widen that namespace.
This plugin was formerly known as Fix Require Modules.
The plugin quickly overgrew its original purpose and got way more features than just fixing require() calls. That's why it got a new name.
However, for the backward compatibility, the previous id fix-require-modules is still used internally and you might find it
All notable changes to this project will be documented in the CHANGELOG.
Contributions are welcome — see CONTRIBUTING to get set up.
Open issues through the issue forms, not as blank issues.
To report a bug from inside Obsidian, run the CodeScript Toolkit: Report a bug command. It opens the bug form with the plugin version, the Obsidian version and your operating system already filled in.
Filing from the CLI or the API (gh issue create --body, or an AI agent filing for you) skips the form, and gh issue create --template cannot load an issue form. In that case, open the matching form in .github/ISSUE_TEMPLATE/, copy every field as a ### <label> heading in the form's order, and fill in each one. Always state the plugin version, the Obsidian version and your operating system.