I'm currently facing an issue with importing UMD libraries using Webpack 2 and ts-loader
. Previously, I had no problems when utilizing Webpack 1 and Rollup (without TypeScript). However, in Webpack 2, it seems to add .default
when calling imported functions.
Here's an example:
import canvg from 'canvg';
canvg();
This code now transforms into:
var canvg_1 = require("canvg");
canvg_1.default();
Resulting in the error
Uncaught TypeError: canvg_1.default is not a function
.
Any suggestions on how to resolve this issue?