-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
If I init a project with "type": "module", install deboa, and create the following script as test.js:
import { Deboa } from 'deboa'
const deboa = new Deboa({
controlFileOptions: {
maintainer: 'John Doe <john@example.com>',
packageName: 'my-awesome-app',
shortDescription: 'users will see this when installing your app',
version: '1.0.0',
},
sourceDir: './dist',
targetDir: './out',
});
deboa.package().then(() => {
console.log('done');
})And run it with node 24 I get the following error:
C:\dev\github\ni\nimble\packages\site>node test.js
node:internal/modules/esm/resolve:274
throw new ERR_MODULE_NOT_FOUND(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\dev\github\ni\nimble\node_modules\deboa\dist\esm\classes\Deboa' imported from C:\dev\github\ni\nimble\node_modules\deboa\dist\esm\index.js
at finalizeResolution (node:internal/modules/esm/resolve:274:11)
at moduleResolve (node:internal/modules/esm/resolve:864:10)
at defaultResolve (node:internal/modules/esm/resolve:990:11)
at #cachedDefaultResolve (node:internal/modules/esm/loader:757:20)
at ModuleLoader.resolve (node:internal/modules/esm/loader:734:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:317:38)
at #link (node:internal/modules/esm/module_job:208:49) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///C:/dev/github/ni/nimble/node_modules/deboa/dist/esm/classes/Deboa'
}
Node.js v24.11.0
I think the reason is the library is using the older "moduleResolution": "node":
Line 14 in a005c1b
| "moduleResolution": "node", |
Would be handy to be able to use it in a node esm environment by updating to, i.e. "moduleResolution": "node16" and updating relative import paths to include the .js extension.
It's possible to workaround the behavior by switching to cjs require:
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const Deboa = require('deboa').Deboa;
const deboa = new Deboa({
controlFileOptions: {
maintainer: 'John Doe <john@example.com>',
packageName: 'my-awesome-app',
shortDescription: 'users will see this when installing your app',
version: '1.0.0',
},
sourceDir: './dist',
targetDir: './out',
});
deboa.package().then(() => {
console.log('done');
})Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels