-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Build: Bundle lib/api with ts-up #19269
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,22 @@ | |
"url": "https://opencollective.com/storybook" | ||
}, | ||
"license": "MIT", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"types": "dist/types/index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, this export map is incorrect - the "exports": {
".": {
"require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
"import": { "types": "./dist/index.d.mts", "default": "./dist/index.mjs" }
},
"./shortcut": {
"require": { "types": "./dist/shortcut.d.ts", "default": "./dist/shortcut.js" },
"import": { "types": "./dist/shortcut.d.mts", "default": "./dist/shortcut.mjs" }
},
"./package.json": "./package.json"
}, Naturally, you'll need those There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for this comment!
Can you explain why? what would be the difference in content of these 2 files?
So this is why it works out in the end, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The The
Knowing if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you so much for taking the time to explain of of this to me (and others reading)! Would you be able to assist us with this migration? |
||
}, | ||
"./shortcut": { | ||
"require": "./dist/shortcut.js", | ||
"import": "./dist/shortcut.mjs", | ||
"types": "./dist/shortcut.d.ts" | ||
}, | ||
Comment on lines
+27
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this something addons use? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"./package.json": "./package.json" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*", | ||
"README.md", | ||
|
@@ -29,7 +42,7 @@ | |
], | ||
"scripts": { | ||
"check": "../../../scripts/node_modules/.bin/tsc --noEmit", | ||
"prep": "node ../../../scripts/prepare.js" | ||
"prep": "../../../scripts/prepare/bundle.ts" | ||
}, | ||
"dependencies": { | ||
"@storybook/channels": "7.0.0-alpha.34", | ||
|
@@ -64,5 +77,11 @@ | |
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"bundler": { | ||
"entries": [ | ||
"./src/index.tsx", | ||
"./src/shortcut.ts" | ||
] | ||
}, | ||
"gitHead": "fc90fc875462421c1faa35862ac4bc436de8e75f" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './dist/esm/lib/shortcut'; | ||
export * from './dist/shortcut'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './lib/shortcut'; | ||
ndelangen marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,8 @@ | |
"@storybook/semver": "^7.3.2", | ||
"@storybook/theming": "7.0.0-alpha.34", | ||
"@testing-library/react": "^11.2.2", | ||
"@types/node": "^14.0.10 || ^16.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't run in the node context, right? What node types are we using? |
||
"@types/webpack-env": "^1.16.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we build these with esbuild, not webpack? Is it weird to depend on webpack env types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. module.hot.accept does not exist in node, that's a webpack runtime thing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use that in |
||
"copy-to-clipboard": "^3.3.1", | ||
"downshift": "^6.0.15", | ||
"enzyme": "^3.11.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference | ||
/// <reference path="./typings.d.ts" /> | ||
/// <reference types="node" /> | ||
/// <reference types="webpack-env" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See: #19269 (comment) |
||
|
||
import global from 'global'; | ||
import React, { FC } from 'react'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a bug with NX where it builds dependents without the --optimized flag
That might be the cause of a few issues... one of those issues I got fixed by adding this, but it's not really what i want to do..
I've reached out to Katarina already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain a little more why that leads to needing to add this? I'm not really following..