Skip to content
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

Error using in typescript file - Uncaught TypeError: window.BotUI is not a constructor #141

Open
IsaacHub opened this issue May 2, 2020 · 1 comment

Comments

@IsaacHub
Copy link

IsaacHub commented May 2, 2020

Throws the following error while using in typescript(.ts) file

Screenshot_36

I'm using this plugin with parcel-bundler.
index.html

<script src="app.ts"></script>

app.ts

import _botui from 'botui';

declare global {
  interface Window {
    BotUI: any
  }
}

let botui = new window.BotUI('bot', {
  vue: Vue
});

I have tried all possible combinations, and getting same error. But works in .js file

@IsaacHub
Copy link
Author

IsaacHub commented May 2, 2020

This can be resolved if parcel allows to exclude botui library from processing bundle.
Unfortunately there is no way of excluding imported files from being bundled in parcel. But using <script> tag we can exclude from bundling with the help of another parcel helper plugin

It works fine while importing in .js file, there's something with the way parcel handles typescript. Or botui is not made for typescript + parcel combo? Other utility/third party libraries are working fine with typescript + parcel.

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

No branches or pull requests

1 participant