Skip to content

ES Modules does not work with namespaced library #27408

Closed

Description

@madmoizo
  • Version: 12.0.0
  • Platform: Windows 10

I'm using experimental-modules since v8. I tried to use "type": "module" in v12 and it's fine except for namespaced library (uuid, lodash, ...)

This kind of imports:

import uuid from 'uuid/v4'
import countBy from 'lodash/countBy'

Causes this error:

internal/modules/esm/default_resolve.js:69
  let url = moduleWrapResolve(specifier, parentURL);
            ^
Error: Cannot find module 'd:\[...]\node_modules\uuid\v4' imported from d:\[...]\[...].mjs
    at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:69:13)
    at Loader.resolve (internal/modules/esm/loader.js:70:33)
    at Loader.getModuleJob (internal/modules/esm/loader.js:143:40)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:43:40)
    at link (internal/modules/esm/module_job.js:42:36)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.experimentalIssues and PRs related to experimental features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions