-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Issues building with Vite/Rollup: "TypeError: Cannot read property 'Decimal128' of null" #12335
Comments
Could you please provide a code sample or perhaps the code leading to that point where the error is thrown? |
Somewhere someone has already fixed it. I think the problem was in sveltekit or the adapter. |
Reproduction: https://stackblitz.com/edit/sveltejs-kit-template-default-jysxco?file=src/hooks.server.js ...
var mongoose$1 = {
exports: {}
};
var lib$5 = {
exports: {}
};
var driver$1 = {};
/*!
* ignore
*/
let driver = null;
driver$1.get = function () {
return driver;
};
driver$1.set = function (v) {
driver = v;
};
...
/**
* Decimal128 type constructor
*
* #### Example:
*
* const id = new mongoose.Types.Decimal128('3.1415');
*
* @constructor Decimal128
*/
var decimal128$3 = driver$1.get().Decimal128; //here
var symbols$3 = {};
symbols$3.arrayAtomicsBackupSymbol = Symbol('mongoose#Array#atomicsBackup');
... |
@AlexRMU I don't see any errors? Maybe I just don't understand how to use StackBlitz |
The error appears after the build is runned.
|
This looks like a bug with how Vite handles bundling. Like you mentioned, the general structure of the file Vite outputs looks like this:
The problem is that the The following doesn't work:
Nor does moving the |
Here is a Reproduction of this issue with a blank SolidStart app: |
Prerequisites
Mongoose version
6.5.3
Node.js version
16.15.0
MongoDB server version
4.4
Description
I'm trying to create a bundle for the prod.
I use esbuild, vite, rollup, sveltekit.
An error appears during building:
Possibly related to #7866
Steps to Reproduce
It is difficult
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: