svg-pan-zoom
svg-pan-zoom copied to clipboard
Library not loading with webpack and import
Bug report
Expected behaviour
Expecting the library to load correctly
Actual behaviour
In a webpack environment (https://github.com/SimulatedGREG/electron-vue), the library doesn't load with either import or require
import:
require:
Steps to reproduce the behaviour
- Clone the repo (https://github.com/SimulatedGREG/electron-vue)
- Install library via npm
- Insert div#drawing element
- Add the following code
import svgPanZoom from 'svg-pan-zoom';
svgPanZoom('#drawing');
Configuration
- svg-pan-zoom version:
3.5.3
- Browser(s):
chrome/electron
- Operating system(s):
W10
Thanks
Hi,
I had this issue as well (using the same electron-vue setup), and was able to work around it by specifying the file to require, like this:
var svgPanZoom = require('svg-pan-zoom/dist/svg-pan-zoom.min.js')
Hope that helps a bit!
I'm facing the same issue. Instead of working around by using require, how does one import svgPanZoom such that you can do e.g.
import ...svgPanZoom..?
svgPanZoom('#demo-tiger', {
zoomEnabled: true,
controlIconsEnabled: true,
fit: true,
center: true
});
I'm using typescript too.