question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storyshots ships *.ts files in dist/ directory

See original GitHub issue

Describe the bug

The current (beta.37 and beta.38) Storyshots package contains TypeScript files along with transpiled files in dist/. This causes jest to (try to) import the wrong file.

To Reproduce

  1. git clone https://github.com/bard/repro-storyshots-dist-ts
  2. cd repro-storyshots-dist-ts
  3. yarn
  4. yarn jest storyshots.test.ts
    /tmp/project/node_modules/@storybook/addon-storyshots/dist/frameworks/frameworkLoader.ts:2
    import fs from 'fs';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

    > 1 | import initStoryshots from '@storybook/addon-storyshots';
        | ^
      2 | 
      3 | initStoryshots()
      4 | 

Expected behavior

Storyshots gets imported without error.

System:

Environment Info:

  System:
    OS: Linux 5.7 Arch Linux
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
  Binaries:
    Node: 14.4.0 - /usr/sbin/node
    Yarn: 1.22.4 - /usr/sbin/yarn
    npm: 6.14.5 - /usr/sbin/npm
  Browsers:
    Firefox: 77.0.1
  npmPackages:
    @storybook/addon-storyshots: 6.0.0-beta.38 => 6.0.0-beta.38 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
floArcommented, Aug 4, 2020

Digging deeper, I found the actual error: In cd61e43e8ba71821caf089e3efb2a688003e31e4 there is a change to exclude framework folder from cleanup for the cli in the prepare script. This seems to have the side-effect on the framework folder withing storyshots. I will see if I can muster the regex knowledge to fix this 😃

2reactions
shilmancommented, Aug 4, 2020

Awesome detective work @floAr. Hero! 🥇

cc @tooppaaa

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to copy non-ts files to dist when building typescript?
When I build (compile) TypeScript project, my template folder is not included in build folder. How to move those kind of files into...
Read more >
CHANGELOG.md ... - GitCode
Bug Fixes. Storyshots: Don't ship typescript files in dist (#11792) ... Maintenance. Ignore testfixtures directory in storybook publish (#9244) ...
Read more >
Issuehunt
I want to use this issue for organizing the TypeScript migration process. ... you are importing does not ship declaration files (types) for...
Read more >
TypeScript Setup & Compilation - Backbencher.dev
Create a folder anywhere to store the project files. ... Here, we are telling TypeScript to store the output in dist directory.
Read more >
@storybook/codemod: Versions | Openbase
Build. Add ability to run tasks from code dir #19588; Make the reporter dynamic #19587 ... Storyshots: Don't ship typescript files in dist...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found