Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Import with extensions #246

Open
julien-f opened this issue May 18, 2021 · 0 comments
Open

Import with extensions #246

julien-f opened this issue May 18, 2021 · 0 comments

Comments

@julien-f
Copy link

Necessary for native ESM support.

Source

import { forEach } from "lodash";

Actual

import _forEach from "lodash/forEach";

Node error:

internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'node_modules/lodash/once' imported from index.mjs
Did you mean to import lodash/once.js?
    at finalizeResolution (internal/modules/esm/resolve.js:276:11)
    at moduleResolve (internal/modules/esm/resolve.js:699:10)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)
    at Loader.resolve (internal/modules/esm/loader.js:88:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:241:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:56:40)
    at link (internal/modules/esm/module_job.js:55:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Expected

import _forEach from "lodash/forEach.js";
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant