Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

[Bug] Built files are es6 modules, but the project is not marked as type: module #2

Closed
IanVS opened this issue Nov 13, 2021 · 1 comment · Fixed by #6
Closed

[Bug] Built files are es6 modules, but the project is not marked as type: module #2

IanVS opened this issue Nov 13, 2021 · 1 comment · Fixed by #6
Labels
bug Something isn't working released This issue/pull request has been released.

Comments

@IanVS
Copy link
Member

IanVS commented Nov 13, 2021

Describe the bug

I was attempting to reproduce a bug using npx sb@next repro, and added jest, @storybook/testing-library, @storybook/testing-react, etc, and am now getting jest errors because of this package:

 Jest encountered an unexpected token

    ...

    Details:

    /Users/ianvs/code/experiments/issue-16677/node_modules/@storybook/testing-library/dist/index.js:16
    import { once } from '@storybook/client-logger';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      1 | import React from 'react';
      2 | import { ComponentStory, ComponentMeta } from '@storybook/react';
    > 3 | import {userEvent, screen} from '@storybook/testing-library';
        | ^
      4 |
      5 | import { Button } from './Button';
      6 |

Steps to reproduce the behavior

IanVS/storybook-issue-16677@8549685

yarn then yarn test

Environment

  • OS: macOS
  • Node.js version: v16.4.0

Additional context

I believe this is because the tsconfig for this project specifies es6 modules as the target output, but module is not specified in the package.json, cjs files aren't also built, and the package.json does not list "type": "module".

@IanVS IanVS added the bug Something isn't working label Nov 13, 2021
@github-actions
Copy link

github-actions bot commented Feb 4, 2022

🚀 Issue was released in v0.0.9 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant