Snap SVG with Typescript and Webpack error “Cannot read property 'on' of undefined”
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an Angular 4 app using Snap SVG and I get the dredded webpack problem "Cannot read property 'on' of undefined". Using snapsvg-cjs seems to be the simplest way to fix this but then I lose all the nice typescript typings (answered here: Typescript library for SVG ). There is some talk of using import-loader but then I would need a web pack config and angular cli takes that away. Plus : import Snap from 'imports-loader?this=>window,fix=>module.exports=0!snapsvg/dist/snap.svg.js'; doesn't compile in typescript. Im pretty new to all this