Skip to main content
Question

Is box-node-sdk compatible with ES6 import ?

  • May 22, 2025
  • 1 reply
  • 4 views

Forum|alt.badge.img

I'm writing a NodeJS app which imports box-node-sdk in a ES6 context.

I am getting this error when I try to package the app :

 > node_modules/vm2/lib/resolver-compat.js:29:8: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning)
    29 │   return require(/* webpackIgnore: true */ moduleName);
       ╵          ~~~~~~~

 > node_modules/vm2/lib/resolver-compat.js:169:33: error: Could not resolve "async_hooks" (set platform to "node" when building for node)
    169 │   const {AsyncResource} = require('async_hooks');
        ╵                                   ~~~~~~~~~~~~~

[ERROR]resolveNpmModules(esbuild):  {
  specifier: 'box-node-sdk',
  dest: '/Users/rupert/Workspaces/test/lwr-project/__lwr_cache__/web_modules'
}
LWR Diagnostic Error: 404: Could not find module entry with specifier "box-node-sdk"

[
  {
    description: {
      category: 'lwrUnresolvable/module',
      advice: [],
      message: '404: Could not find module entry with specifier "box-node-sdk"'
    }
  }
]
DiagnosticsError: 404: Could not find module entry with specifier "box-node-sdk"

    at createSingleDiagnosticError (file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/diagnostics/build/es/errors.js:6:12)
    at LwrModuleRegistry.delegateGetModuleEntryOnServices (file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/module-registry/build/es/index.js:214:15)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async resolveExternalImport (file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/module-registry/build/es/module-record.js:39:35)
    at async getModuleRecord (file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/module-registry/build/es/module-record.js:80:44)
    at async LwrModuleRegistry.createModuleDefinition (file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/module-registry/build/es/index.js:103:30)
    at async getModuleGraphs (file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/shared-utils/build/es/graph.js:117:11)
    at async file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/view-registry/build/es/linkers/legacy_view_bootstrap.js:107:23
    at async Promise.all (index 0)
    at async getHtmlResources (file:///Users/rupert/Workspaces/test/lwr-project/node_modules/@lwrjs/view-registry/build/es/linkers/legacy_view_bootstrap.js:106:5)

 

 

Is box-node-sdk compatible with ES6 ?

1 reply

Forum|alt.badge.img

Hi 378083437814,

To avoid repeating we will continue our conversation on the github issue you created here https://github.com/box/box-node-sdk/issues/708.

Regards,
Artur