cubiq / add-to-homescreen

Add to home screen call-out for mobile devices
http://cubiq.org/add-to-home-screen
2.29k stars 747 forks source link

Webpack "addToHomescreen is not defined" #242

Open CorvusCorrax opened 7 years ago

CorvusCorrax commented 7 years ago

When i import npm addToHomescreen module (v5.0.0) using webpack, i get an "addToHomescreen is not defined" on addToHomescreen()

nicolas-ligny commented 7 years ago

did you try importing it into a variable in the script where you initialize the addToHomescreen?

import addToHomescreen from '../vendor/addtohomescreen.min'; followed by addToHomescreen({ skipFirstVisit: true, startDelay: 15, });

EnricoVogt commented 6 years ago

This works for me with webpack:

import addToHomescreen from 'add-to-homescreen/dist/addtohomescreen.min';
import addToHomescreenCSS from 'add-to-homescreen/dist/style/addtohomescreen.css';

window.addToHomescreen()