Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Interaction addon break storybook in 7.1.0 #23509

Closed
loic-enedis opened this issue Jul 19, 2023 · 3 comments
Closed

[Bug]: Interaction addon break storybook in 7.1.0 #23509

loic-enedis opened this issue Jul 19, 2023 · 3 comments

Comments

@loic-enedis
Copy link

Describe the bug

Bug appeared after updating @storybook/addon-interactions from 7.0.27 into 7.1.0.

Using pnpm 7.24.3

Here is the full log of the issue :

✘ [ERROR] Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]

../../node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1360:21:
  1360 │         let result = await callback({
       ╵                      ^

at packageEntryFailure (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23384:11)
at resolvePackageEntry (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23381:5)
at tryNodeResolve (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23115:20)
at Context.resolveId (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:22876:28)
at Object.resolveId (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42811:46)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:64074:21
at async file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23691:34
at async requestCallbacks.on-resolve (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1360:22)

This error came from the "onResolve" callback registered here:

../../node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1279:20:
  1279 │       let promise = setup({
       ╵                     ^

at setup (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23671:19)
at handlePlugins (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1279:21)
at buildOrContextImpl (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:968:5)
at Object.buildOrContext (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:776:5)
at /workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:2172:68
at new Promise (<anonymous>)
at Object.context (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:2172:27)
at Object.context (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:2012:58)
at prepareEsbuildOptimizerRun (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:44414:35)

The plugin "vite:dep-pre-bundle" was triggered by this import

../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js:1:17:
  1 │ var fs = require('fs')
    ╵                  ~~~~

/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1636
let error = new Error(${text}${summary});
^

Error: Build failed with 1 error:
../../node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1360:21: ERROR: [plugin: vite:dep-pre-bundle] Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json.
at failureErrorWithLog (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1636:15)
at /workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1048:25
at /workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1512:9
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errors: [
{
detail: Error: Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json.
at packageEntryFailure (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23384:11)
at resolvePackageEntry (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23381:5)
at tryNodeResolve (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23115:20)
at Context.resolveId (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:22876:28)
at Object.resolveId (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42811:46)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:64074:21
at async file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23691:34
at async requestCallbacks.on-resolve (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1360:22),
id: '',
location: {
column: 21,
file: '../../node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js',
length: 0,
line: 1360,
lineText: ' let result = await callback({\n' +
' at packageEntryFailure (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23384:11)\n' +
' at resolvePackageEntry (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23381:5)\n' +
' at tryNodeResolve (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23115:20)\n' +
' at Context.resolveId (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:22876:28)\n' +
' at Object.resolveId (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42811:46)\n' +
' at runMicrotasks ()\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
' at async file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:64074:21\n' +
' at async file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23691:34\n' +
' at async requestCallbacks.on-resolve (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1360:22)',
namespace: 'file',
suggestion: ''
},
notes: [
{
location: {
column: 20,
file: '../../node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js',
length: 0,
line: 1279,
lineText: ' let promise = setup({\n' +
' at setup (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23671:19)\n' +
' at handlePlugins (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:1279:21)\n' +
' at buildOrContextImpl (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:968:5)\n' +
' at Object.buildOrContext (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:776:5)\n' +
' at /workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:2172:68\n' +
' at new Promise ()\n' +
' at Object.context (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:2172:27)\n' +
' at Object.context (/workspaces/source-design-system/node_modules/.pnpm/esbuild@0.17.18/node_modules/esbuild/lib/main.js:2012:58)\n' +
' at prepareEsbuildOptimizerRun (file:///workspaces/source-design-system/node_modules/.pnpm/vite@4.3.5/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:44414:35)',
namespace: 'file',
suggestion: ''
},
text: 'This error came from the "onResolve" callback registered here:'
},
{
location: {
column: 17,
file: '../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js',
length: 4,
line: 1,
lineText: "var fs = require('fs')",
namespace: '',
suggestion: ''
},
text: 'The plugin "vite:dep-pre-bundle" was triggered by this import'
}
],
pluginName: 'vite:dep-pre-bundle',
text: 'Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json.'
}
],
warnings: []
}

To Reproduce

No response

System

Environment Info:

  System:
    OS: Linux 5.15 Alpine Linux
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-1240P
  Binaries:
    Node: 16.19.0 - /usr/local/bin/node
    npm: 8.19.3 - /usr/local/bin/npm
  npmPackages:
    @storybook/addon-a11y: 7.1.0 => 7.1.0 
    @storybook/addon-actions: 7.1.0 => 7.1.0 
    @storybook/addon-essentials: 7.1.0 => 7.1.0 
    @storybook/addon-interactions: 7.0.27 => 7.0.27 
    @storybook/addon-links: 7.1.0 => 7.1.0 
    @storybook/addons: 7.1.0 => 7.1.0 
    @storybook/jest: ^0.1.0 => 0.1.0 
    @storybook/manager-api: 7.1.0 => 7.1.0 
    @storybook/testing-library: ^0.1.0 => 0.1.0 
    @storybook/theming: 7.1.0 => 7.1.0 
    @storybook/web-components: 7.1.0 => 7.1.0 
    @storybook/web-components-vite: 7.1.0 => 7.1.0

Additional context

No response

@vanessayuenn
Copy link
Contributor

vanessayuenn commented Jul 25, 2023

Looks to be the same issue as #23570 which should be solved by #23597

@vanessayuenn
Copy link
Contributor

This should be fixed now via #23597. Closing for now, but please feel free to reopen if the issue persists in the latest version of Storybook. Thanks.

@EvHaus
Copy link
Contributor

EvHaus commented Aug 9, 2023

I was running into this issue after upgrading from 7.2.0 to 7.2.1, and still seeing the issue in Storybook 7.2.2. The full failure:

✘ [ERROR] Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]

    ../../node_modules/esbuild/lib/main.js:1370:21:
      1370 │         let result = await callback({
           ╵                      ^

    at packageEntryFailure (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28691:11)
    at resolvePackageEntry (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28688:5)
    at tryNodeResolve (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28419:20)
    at Context.resolveId (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28180:28)
    at Object.resolveId (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:44207:64)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:65837:21
    at async file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:39941:34
    at async requestCallbacks.on-resolve (/Users/evhaus/project/node_modules/esbuild/lib/main.js:1370:22)
    at async handleRequest (/Users/evhaus/project/node_modules/esbuild/lib/main.js:729:13)

  This error came from the "onResolve" callback registered here:

    ../../node_modules/esbuild/lib/main.js:1289:20:
      1289 │       let promise = setup({
           ╵                     ^

    at setup (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:39921:19)
    at handlePlugins (/Users/evhaus/project/node_modules/esbuild/lib/main.js:1289:21)
    at buildOrContextImpl (/Users/evhaus/project/node_modules/esbuild/lib/main.js:978:5)
    at Object.buildOrContext (/Users/evhaus/project/node_modules/esbuild/lib/main.js:786:5)
    at /Users/evhaus/project/node_modules/esbuild/lib/main.js:2182:68
    at new Promise (<anonymous>)
    at Object.context (/Users/evhaus/project/node_modules/esbuild/lib/main.js:2182:27)
    at Object.context (/Users/evhaus/project/node_modules/esbuild/lib/main.js:2022:58)
    at prepareEsbuildOptimizerRun (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:45967:35)

  The plugin "vite:dep-pre-bundle" was triggered by this import

    ../../node_modules/graceful-fs/graceful-fs.js:1:17:
      1 │ var fs = require('fs')
        ╵                  ~~~~

/Users/evhaus/project/node_modules/esbuild/lib/main.js:1646
  let error = new Error(`${text}${summary}`);
              ^

Error: Build failed with 1 error:
../../node_modules/esbuild/lib/main.js:1370:21: ERROR: [plugin: vite:dep-pre-bundle] Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json.
    at failureErrorWithLog (/Users/evhaus/project/node_modules/esbuild/lib/main.js:1646:15)
    at /Users/evhaus/project/node_modules/esbuild/lib/main.js:1058:25
    at /Users/evhaus/project/node_modules/esbuild/lib/main.js:1522:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [
    {
      detail: Error: Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json.
          at packageEntryFailure (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28691:11)
          at resolvePackageEntry (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28688:5)
          at tryNodeResolve (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28419:20)
          at Context.resolveId (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28180:28)
          at Object.resolveId (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:44207:64)
          at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
          at async file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:65837:21
          at async file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:39941:34
          at async requestCallbacks.on-resolve (/Users/evhaus/project/node_modules/esbuild/lib/main.js:1370:22)
          at async handleRequest (/Users/evhaus/project/node_modules/esbuild/lib/main.js:729:13),
      id: '',
      location: {
        column: 21,
        file: '../../node_modules/esbuild/lib/main.js',
        length: 0,
        line: 1370,
        lineText: '        let result = await callback({\n' +
          '    at packageEntryFailure (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28691:11)\n' +
          '    at resolvePackageEntry (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28688:5)\n' +
          '    at tryNodeResolve (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28419:20)\n' +
          '    at Context.resolveId (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:28180:28)\n' +
          '    at Object.resolveId (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:44207:64)\n' +
          '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
          '    at async file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:65837:21\n' +
          '    at async file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:39941:34\n' +
          '    at async requestCallbacks.on-resolve (/Users/evhaus/project/node_modules/esbuild/lib/main.js:1370:22)\n' +
          '    at async handleRequest (/Users/evhaus/project/node_modules/esbuild/lib/main.js:729:13)',
        namespace: 'file',
        suggestion: ''
      },
      notes: [
        {
          location: {
            column: 20,
            file: '../../node_modules/esbuild/lib/main.js',
            length: 0,
            line: 1289,
            lineText: '      let promise = setup({\n' +
              '    at setup (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:39921:19)\n' +
              '    at handlePlugins (/Users/evhaus/project/node_modules/esbuild/lib/main.js:1289:21)\n' +
              '    at buildOrContextImpl (/Users/evhaus/project/node_modules/esbuild/lib/main.js:978:5)\n' +
              '    at Object.buildOrContext (/Users/evhaus/project/node_modules/esbuild/lib/main.js:786:5)\n' +
              '    at /Users/evhaus/project/node_modules/esbuild/lib/main.js:2182:68\n' +
              '    at new Promise (<anonymous>)\n' +
              '    at Object.context (/Users/evhaus/project/node_modules/esbuild/lib/main.js:2182:27)\n' +
              '    at Object.context (/Users/evhaus/project/node_modules/esbuild/lib/main.js:2022:58)\n' +
              '    at prepareEsbuildOptimizerRun (file:///Users/evhaus/project/node_modules/vite/dist/node/chunks/dep-df561101.js:45967:35)',
            namespace: 'file',
            suggestion: ''
          },
          text: 'This error came from the "onResolve" callback registered here:'
        },
        {
          location: {
            column: 17,
            file: '../../node_modules/graceful-fs/graceful-fs.js',
            length: 4,
            line: 1,
            lineText: "var fs = require('fs')",
            namespace: '',
            suggestion: ''
          },
          text: 'The plugin "vite:dep-pre-bundle" was triggered by this import'
        }
      ],
      pluginName: 'vite:dep-pre-bundle',
      text: 'Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json.'
    }
  ],
  warnings: []
}

Node.js v20.3.1

Rolling back to Storybook 7.0.27 didn't help. The problem was the @storybook/icons package which had a dependency for figma-api-exporter which had a dependency on fs@^0.0.1-security. That package is what breaks everything.

I was able to fix this by manually updating the lock file to forcing npm to install @storybook/icons@1.1.6.

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

No branches or pull requests

4 participants