how to use it without require or import
arsinawaz opened this issue · comments
Hi,
i am using an application which does not support require or import methods, is there any other way to use the plugin? or any help in how to setup import/require support for my application.
Any help is appreciated.
Many thanks in advance.
Can you describe more about your application. Is it a website or node app or...
I'm having the same issue, I'm working in a .NET Webforms application that doesn't use Node or Require. Is there any other way to get it working?
Thanks
@cnieren ya, it should auto-detect if there is require
or define
or module.export
and use those, and if not it should attach itself to the global, making it accessible as ES6Promise
.
Is it possible you have a loader that exposesdefine
?
You are right, it does attach to global, the issue I'm having now is with the Typescript definition file. Because I have to use the "module": "none" compiler option, I'm getting a Typescript compiler error.
Thanks for your help.
var Promise = Promise || ES6Promise.Promise
Set your tsconfig.json
to be like this
{
"compilerOptions": {
...
"target": "es5",
"lib": [ "dom", "es2015" ],
}
}
That lib bit is critical - it tells TypeScript to just assume certain libraries are available in the environment. This polyfill then provides those libraries. No need for any TypeScript definition files then.
(I use the above with es6-shim and this library)
This seems to be resolved?