Skip to content

Conversation

@hasezoey
Copy link
Collaborator

Summary

This PR exposes SchemaTypeOptions on the browser build, like it is on the non-browser build.
As a workaround, it is already accessible via mongoose.Schema.Types.Mixed.prototype.OptionsConstructor (or similar) without this PR.

Btw, is the browser build still something that is supported?

like in the non-browser build
@vkarpov15
Copy link
Collaborator

The browser build is still supported, but I've been thinking about splitting it off into a plugin for Mongoose 9 for several reasons, including the following. What do you think?

  1. Makes bundling difficult
  2. Browser build accounts for around 30% of the Mongoose npm package size

@hasezoey
Copy link
Collaborator Author

hasezoey commented Mar 1, 2025

but I've been thinking about splitting it off into a plugin for Mongoose 9 for several reasons, including the following. What do you think?

Sounds great to me, this would mean, aside from the points you already said, that there would likely be less confusion about mongoose normal build and browser build, right?
Though i am curious, this "plugin" way, would it continue to use the current lib/browser* code, or try to compile it whole (without a driver)?
Also, wouldnt this mean that now there would be 2 packages, ie mongoose and mongoose-browser, or did you think of a different way?

In any case, it would likely be good to have a discussion about this instead of doing it in this PR.

@vkarpov15
Copy link
Collaborator

Yeah I'll move the discussion to a separate issue #15296. But yes, the idea would be to have a separate @mongoosejs/browser or mongoose-browser npm package that users would have to explicitly add to use the browser build.

@vkarpov15 vkarpov15 merged commit 8c7e32d into Automattic:master Mar 3, 2025
39 checks passed
@vkarpov15 vkarpov15 added this to the 8.12 milestone Mar 3, 2025
@hasezoey hasezoey deleted the browserSchemaTypeOptions branch March 4, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants