Invalid "exports" target "src/once.js" defined for "." in the package config

Created on 5 August 2024, 11 months ago

Problem/Motivation

Using `@drupal/once` installed from npm in Storybook, I see the following error:
```
Module not found: Error: Invalid "exports" target "src/once.js" defined for "." in the package config node_modules/@drupal/once/package.json, targets must start with "./"
```

Proposed resolution

In the package.json file, the exports path should use a relative path starting with ./

🐛 Bug report
Status

Active

Component

Code

Created by

🇺🇸United States kmonahan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @kmonahan
  • Pipeline finished with Failed
    11 months ago
    #244639
  • Pipeline finished with Failed
    11 months ago
    #244640
  • Merge request !30Update exports to use relative path → (Open) created by kmonahan
  • Status changed to Needs review 11 months ago
  • 🇺🇸United States kmonahan

    Opened MR with the fix

  • 🇺🇸United States calebtr

    I also see this issue, in Storybook 8.2. I do not see it when using @drupal/once with Storybook 8.1.

    This change resolves the issue on 8.2 and doesn't introduce errors in 8.1.

  • Status changed to RTBC 11 months ago
  • 🇨🇿Czech Republic parisek

    Thank you I have same issue and it resolved it, I think we can move on to RTBC

  • 🇫🇮Finland heikkiy Oulu

    We encounted this same issue with Storybooks and tested that the same change fixes the issue. So +1 for RTBC.

    Could this be merged and a new release done both to drupal.org and https://www.npmjs.com/package/@drupal/once?

  • 🇨🇦Canada aastrong

    Wanted to comment on this to see if we can push it forward.
    I've also tested and it fixes my issues with compiling.

  • 🇨🇦Canada nickdjm

    Just wanted to throw another review on to this.

    Was having issues with once in a framework I'm working on, with the following error:

    (node-resolve plugin) Could not resolve import "@drupal/once" in [root]/packages/core/src/js/alert/generator.js using exports defined in [root]/node_modules/@drupal/once/package.json. Invalid mapping: "src/once.js".

    This patch resolves the issue entirely.

Production build 0.71.5 2024