Closed tyler-dunkel closed 2 years ago
I have isolated the issue down to this line
this.manager.options.requireCoreModules
&& require.resolve(requiredName) === requiredName;
within pluginVM.js
function isCoreModule
with requiredName === src/plugins/@myNamespace/myModule/dist/services/index.js
Still investigating further.
Note: I updated the install and require commands to be pluginManager.install('moment')
and pluginManager.require('moment')
and am encountering the same error at the same line.
Error: Cannot find module 'src/plugins/moment/moment.js'
I have isolated further and believe it has something to do with the pluginsPath
property of the PluginManager
constructor. I have a small file that I just run node index.js
on. This works:
import {PluginManager} from "live-plugin-manager";
async function test() {
const pluginManager = new PluginManager({
})
await pluginManager.install('moment')
const moment = pluginManager.require('moment')
console.log(moment)
}
test()
This produces an error
import {PluginManager} from "live-plugin-manager";
async function test() {
const pluginManager = new PluginManager({
pluginsPath: './plugins'
})
await pluginManager.install('moment')
const moment = pluginManager.require('moment')
console.log(moment)
}
test()
If I remember well pluginsPath should be an absolute path. Sorry in fact documentation is not clear... Can you try to put an absolute path?
yes this worked thank you. Just having issues with certain packages now.
Hi,
I am trying to use
live-plugin-manager
in my cli tool and am having a couple issues.pluginManager.install
installs the package but does not install its dependencies.pluginManager.require
gives a "module not found" error even if I cd to the module directory and install the dependencies manually.error text:
I am able to successfully require the package using either
await import('${pathToModuleInPluginDir')
orrequire('$pathToModuleInPluginDir'
after manually installing dependencies but runningpluginManager.require('moduleName')
fails with no found.My setup is fairly simple, here is how I am initializing the plugin manager:
I tried the suggestion from another issue of using
hostRequire: undefined
but had the same result.Here is the code requiring the plugin:
Note
importPath
=== something like@myNamespace/myModule
Any ideas?Thanks!