Skip to content

fix: Cannot find module generate-slug imported from anchor-links/index.js#235

Open
mterrel wants to merge 1 commit into
hashicorp:mainfrom
mterrel:anchorlinks-esm
Open

fix: Cannot find module generate-slug imported from anchor-links/index.js#235
mterrel wants to merge 1 commit into
hashicorp:mainfrom
mterrel:anchorlinks-esm

Conversation

@mterrel
Copy link
Copy Markdown

@mterrel mterrel commented Jun 28, 2023

Fixes: #234

🎟️ Asana Task


Description

Fixes the following error when trying to import anchorLinks:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/mark/xxx/node_modules/@hashicorp/platform-remark-plugins/util/generate-slug' imported from /home/mark/xxx/node_modules/@hashicorp/platform-remark-plugins/plugins/anchor-links/index.js
    at new NodeError (internal/errors.js:322:7)
    at finalizeResolution (internal/modules/esm/resolve.js:308:11)
    at moduleResolve (internal/modules/esm/resolve.js:731:10)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:842:11)
    at Loader.resolve (internal/modules/esm/loader.js:89:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
    at link (internal/modules/esm/module_job.js:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

The problem here is that the package has been migrated to ESM incompletely. Specifically, imports in an ESM project must include the file extension. This PR adds .js to the offending import.

PR Checklist 🚀

  • Conduct thorough self-review.
  • Add or update tests as appropriate.
  • Write a useful description (above) to give reviewers appropriate context.
  • Identify (in the description above) and document (add Asana tasks on this board) any technical debt that you're aware of, but are not addressing as part of this PR.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 28, 2023

⚠️ No Changeset found

Latest commit: 750b1b9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@hashicorp-cla
Copy link
Copy Markdown

hashicorp-cla commented Jun 28, 2023

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot find module '.../generate-slug' imported from .../anchor-links/index.js

2 participants