Open marvinhagemeister opened 7 months ago
That's expected because the module doesn't seem to define itself as Node ESM. The same thing happens in Node:
> node main.mjs
file:///V:/scratch/node_modules/@esri/calcite-components/dist/components/index.js:7
export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client/index.js';
^^^^^^^^^^^^
SyntaxError: Named export 'getAssetPath' not found. The requested module '@stencil/core/internal/client/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@stencil/core/internal/client/index.js';
const { getAssetPath, setAssetPath, setNonce, setPlatformOptions } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:120:12)
Node.js v21.6.1
That said, in the next version of Deno we're changing this to load CJS modules that uses ES module syntax to work, but the following error occurs due to the Node ESM code doing a directory import:
> deno run main.mjs
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///V:/scratch/node_modules/@esri/calcite-components/node_modules/@stencil/core/internal/app-data' is not supported resolving ES modules imported from file:///V:/scratch/node_modules/@esri/calcite-components/node_modules/@stencil/core/internal/client/index.js
Good point, maybe that's one of those modules that assume to be put through a bundler by default.
I think so. Btw, for the ERR_UNSUPPORTED_DIR_IMPORT
, I wonder if we should apply sloppy import resolution within npm packages when sloppy imports is enabled.
Steps to reproduce:
Error:
Version: Deno 1.41.3