-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
1.3.1 TypeScript example doesn't work with Browserify #186
Comments
Dexie does indeed default export in its source version at src/Dexie.js and in dist/dexie.es6.js. The transpiled UMD module (dexie.js) may not do this though, but if you target your typescript to es6 and then use babel to get the es5 code it should work. In my typescript sample, I use a setup with tsc + babel + webpack and that works just fine. Haven't tested the setup with tsc + babel + browserify, but I suppose that combo is common too. If it's a problem with compiling from ts-->es5 directly with browserify, I must fix it because that would be a common thing to use. Any suggestions? |
Seems tsc behaves differently when targeting es5. I've updated the README.md to clarify that you need to target es6 for the sample to work. |
Ok, so now I've found a workaround that makes dexie.d.ts work both when tsc is targeting es5 and es6. SImply setting Dexie.default = Dexie makes it work in both cases and does not interfere with anything else. |
It's working now. Thanks! |
The TypeScript code is set up assuming ES6 modules with a default export are used, but in practice dexie.js does not use a default export.
Trying to subclass Dexie then fails:
Generates the following JS:
When running in Browserify,
dexie_1.default
is undefined, leading to an error when the__extends
helper tries to inherit the prototype.The text was updated successfully, but these errors were encountered: