-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add UMD bundle for @xstate/react. #1738
Conversation
🦋 Changeset detectedLatest commit: c7422c2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thanks @dimitardanailov! Can you also add a changeset?
|
Please review my commit: b4f8dd4 |
globals: { | ||
xstate: 'XState', | ||
'@xstate/react': 'XStateReact', | ||
'@react/composition-api': 'reactCompositionApi' |
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.
this doesn't exist, could you remove this entry?
createUmdConfig({ | ||
name: 'XStateReact', | ||
input: 'src/index.ts', | ||
output: 'dist/xstate-react.min.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.
This is what will be generated in v5 by Preconstruct and this ain't configurable there, so to avoid a small breaking change in the future we can already name this file this:
output: 'dist/xstate-react.min.js' | |
output: 'dist/xstate-react.umd.min.js' |
} | ||
|
||
export default [ | ||
createUmdConfig({ |
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.
in v5 we won't be generating unminified UMD bundles, so let's drop this for now
'@react/composition-api': 'reactCompositionApi' | ||
} | ||
}, | ||
plugins: [createTSCofig(), terser({ include: [/^.+\.min\.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.
as mentioned in the other comment - let's just focus on producing minified bundles
createUmdConfig({ | ||
name: 'XStateReactFSM', | ||
input: 'src/fsm.ts', | ||
output: 'dist/xstate-react.fsm.min.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.
Similar to the other comment about v5 - we should be naming this file like this:
output: 'dist/xstate-react.fsm.min.js' | |
output: 'dist/xstate-react-fsm.umd.min.js' |
packages/xstate-react/README.md
Outdated
**Via CDN** | ||
|
||
```html | ||
<script src="https://unpkg.com/@xstate/react/dist/xstate-react.min.js"></script> |
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.
after adjusting configs please remember about adjusting those URLs here
Thank you very much for the additional advices. I've created three new commits. Please review my improvements. |
Thanks! |
Thank you very much for the collaboration. I'd like to share: What I found. Before that: I'd like to give you access to my playground area: branch: The component throws an error if the import is:
The error is: My recommendation is: https://www.npmjs.com/package/@rollup/plugin-replace What do you think ? |
Ah - yes. This is the appropriate approach. I've missed that this will be required during the code review. Are you willing to prepare a PR with the fix? |
The pull request is based on #1108.
The pull request should close the following issue: #1736