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
SDK: Fix bundles #10053
Merged
Merged
SDK: Fix bundles #10053
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The problem was coming from rollup building only for browsers. The solution is to specify build for browsers and Node.js. This configuration is inherited from format-title package, but with the slight difference that exports .mjs files
@joselcvarela The build doesn't seem to like that 🤔 Could you check what's up with
|
Yeah, I am already on it 😁 |
@rijkvanzanten seems to be fixed now |
Don't know why, but it seems you were not assigned as reviewer on this PR @rijkvanzanten. I am putting manually. |
rijkvanzanten
approved these changes
Dec 1, 2021
We can keep discussing optimizing the build on #10204 |
rijkvanzanten
pushed a commit
that referenced
this pull request
Dec 1, 2021
* Fix bundles The problem was coming from rollup building only for browsers. The solution is to specify build for browsers and Node.js. This configuration is inherited from format-title package, but with the slight difference that exports .mjs files * fix types folder
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes ##8079
Although this seemed to be fixed, for Nuxt builds it was complaining about
XMLHttpRequest is not defined
I believe the cause of this Rollup for SDK was only building for browsers, ignoring Node:
directus/packages/sdk/rollup.config.js
Lines 21 to 23 in 53b8b6b
Inside Axios the
getAdapater
was always returning thexhrAdapter
.In order to fix this, I have inherited configuration from
format-title
with the slight difference that exports.mjs
for ES modules instead of regular.js
.Now Is uses
xhrAdapter
for browsers andhttpAdapter
for Node.Tested and working on Nuxt, React, Node CJS, Node MJS and TS-Node.