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

Compatibility with Node v22 #70

Closed
pcorpet opened this issue Sep 22, 2024 · 1 comment
Closed

Compatibility with Node v22 #70

pcorpet opened this issue Sep 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pcorpet
Copy link

pcorpet commented Sep 22, 2024

Bug description
When using node v22.9.0, importing the package raises an error

To Reproduce
Create a simple repro-bug-assert.mjs in a package with latest version of this package:

import 'storybook-addon-remix-react-router'

Check that you have installed node v22+

$ node --version
v22.2.0

Run the test file:

$ node ./repro-bug-assert.mjs
file:///.../node_modules/storybook-addon-remix-react-router/dist/index.js:3
import de from '../package.json' assert { type: 'json' };

SyntaxError: Unexpected identifier 'assert'

Additional context
This is because of nodejs/node#52104 which removed the support of assert in node v22+, and that the builded ESM version of the package contains

import { makeDecorator, addons } from '@storybook/preview-api';
import P, { useState, useMemo, useCallback, useRef } from 'react';
import de from '../package.json' assert { type: 'json' };

Replacing assert with with works.

Environment

Storybook Environment Info:

  System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M2 Pro
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 22.2.0 - /opt/homebrew/bin/node
    Yarn: 4.0.1 - /opt/homebrew/bin/yarn <----- active
    npm: 10.7.0 - /opt/homebrew/bin/npm
    pnpm: 9.3.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 128.0.6613.138
    Safari: 18.0
  npmPackages:
    @storybook/addon-designs: 8.0.3 => 8.0.3 
    @storybook/addon-essentials: 8.3.1 => 8.3.1 
    @storybook/addon-interactions: 8.3.1 => 8.3.1 
    @storybook/addon-links: 8.3.1 => 8.3.1 
    @storybook/addon-themes: 8.3.1 => 8.3.1 
    @storybook/blocks: 8.3.1 => 8.3.1 
    @storybook/channels: 8.3.1 => 8.3.1 
    @storybook/components: 8.3.1 => 8.3.1 
    @storybook/core-events: 8.3.1 => 8.3.1 
    @storybook/manager-api: 8.3.1 => 8.3.1 
    @storybook/preview-api: 8.3.1 => 8.3.1 
    @storybook/react: 8.3.1 => 8.3.1 
    @storybook/react-vite: 8.3.1 => 8.3.1 
    @storybook/theming: 8.3.1 => 8.3.1 
    eslint-plugin-storybook: ^0.8.0 => 0.8.0 
    storybook: 8.3.1 => 8.3.1 
    storybook-addon-remix-react-router: 3.0.0 => 3.0.0 

@pcorpet pcorpet added the bug Something isn't working label Sep 22, 2024
@JesusTheHun
Copy link
Owner

Hi @pcorpet , thank you for this thorough report.

This has been fixed in v3.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants