-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Typescript Browser ReferenceError: qq is not defined #1838
Comments
So upon further digging into the codebase, it looks like fine-uploader uses UMD module design. Since Typescript users will in all likelihood use some sort of module mechanism other than the global namespace, this creates a problem with the way that the declaration file is currently structured. It looks like the current declaration file is structured using this global declaration template. However, since the project can be modularized and Typescript users will almost definitely be using modules, it should use this template. Why does it need to be this way? Because Typescript users won't have the I would be happy to refactor the Typescript as best I can if you want. I have already altered it appropriately for my usecase, but I can expand my fixes to the entire scope and submit a pull request. |
@jclangst Yes the current declaration file is structured using global declaration template and it is required that the fine-uploader JS file be included in project's index.html. I see your point and I already wanted to look at this for a while now. |
@jclangst What was your work-around to get the current version working for your use case? I'm running into the same issues due to qq not being exposed in the underlying JS. |
Fixed in #1840 and released in version 5.15.0 |
Type of issue
Uploader type
Bug Report
Fine Uploader version
5.14.2
Browsers where the bug is reproducible
Chrome 58
Operating systems where the bug is reproducible
Ubuntu 17.04
Exact steps required to reproduce the issue
Note: This occurs in a Typescript Angular project being bundled by Webpack with the awesome-typescript-loader.
My
tsconfig.json
:Error was discovered using the below file snippet, but can also be reproduced using the first 26 lines of `fine-uploader.tests.ts'.
The error occurs at
new qq.FineUploader(...)
.All relevant Fine Uploader-related code that you have written
Detailed explanation of the problem
When trying to integrate fine-uploader with a Typescript project by following the example set in
fine-uploader.tests.ts
the project compiles correctly but the browser produces a reference error:ReferenceError: qq is not defined
.What is weird is that typescript will compile the project properly and the error only appears in runtime.
Now if I add a node.js require like
let qq = require('fine-uploader')
before usingqq
everything will work out fine. Though this seems a little too hacky to be the go-to solution.The text was updated successfully, but these errors were encountered: