Storyshots ships *.ts files in dist/ directory
See original GitHub issueDescribe 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
git clone https://github.com/bard/repro-storyshots-dist-ts
cd repro-storyshots-dist-ts
yarn
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:
- Created 3 years ago
- Reactions:2
- Comments:17 (10 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 😃
Awesome detective work @floAr. Hero! 🥇
cc @tooppaaa