-
Notifications
You must be signed in to change notification settings - Fork 1
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: support multi-entry build #1
build: support multi-entry build #1
Conversation
@@ -52,7 +62,8 @@ | |||
}, | |||
"scripts": { | |||
"start": "tsdx watch", | |||
"build": "tsdx build", | |||
"build": "tsdx build --entry src/index.tsx --entry src/register.tsx && npm run post-build", | |||
"post-build": "node scripts/post-tsdx.js", |
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.
needed a post tsdx step to fix the cjs enty files (dist/index.js
points at the wrong files and dist/register.js
does not exist)
"exports": { | ||
".": { | ||
"import": "./dist/index.esm.js", | ||
"require": "./dist/index.js" | ||
}, | ||
"./register": { | ||
"import": "./dist/register.esm.js", | ||
"require": "./dist/register.js" | ||
} | ||
}, |
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 have not tested this out yet, https://nodejs.org/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards might be useful but "type": "module"
does not play well with TSDX
@@ -0,0 +1,16 @@ | |||
// TSDX does not currently support multiple entry files out of the box, |
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.
TSDX does not currently support multiple entry files out of the box, so I had to overwrite the Rollup config
Ref: jaredpalmer/tsdx#175 (comment)
@micmro I was thinking of just tossing out tsdx all together and just creating a tsc build with esm and cjs outputs. wdyt? |
Makes sense, tsdx works great for simple projects but is's quite limiting. I'll just need find time for this. |
In the event that we end up keeping this approach... I finally tested this out tonight (sorry for the delay!) but had some issues implementing it in the test app. I could only get Webpack to resolve the import from I'm currently installing it from a local directory |
@brendanrygus I'm pretty sure storybook resolves modern ES6 code, so we could potentially just use tsc and have it build for ES6 |
Hi @brendanrygus
I got the multi-entry build working, can you check if this works for your needs?