-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
Related: #2851
With #2863 handled, MarkBind's core code is now outputting ESM. This means that custom plugins are now handled differently. We need to look into whether we can accept both CJS and ESM plugins from users without workarounds, or if we have to support just ESM officially (in which case we have to create a deprecation notice).
Technical information:
First, PluginManager.ts resolves the plugin path URL:
markbind/packages/core/src/plugins/PluginManager.ts
Lines 135 to 139 in 510231a
| // Check the environment's node_modules folders | |
| try { | |
| const resolvedPluginPath = require.resolve(pluginName); | |
| return resolvedPluginPath; | |
| } catch (err) { |
Then, Plugin.ts actually imports/requires it:
markbind/packages/core/src/plugins/Plugin.ts
Lines 56 to 60 in 510231a
| /** | |
| * The plugin module | |
| */ | |
| // eslint-disable-next-line import/no-dynamic-require | |
| this.plugin = require(pluginPath); |
All this is done with createRequire
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels