pnotify: Using with webpack crashes a page
I’m using webpack with pnotify (I get pnotify 3.0.0 from npm registry) in my project. So, when I use pnotify 3.0.0 it crashes a site. The reason is here (pnotify.js line 865)
if (root.document.body) {
do_when_ready();
} else {
$(do_when_ready);
}
because root is only an object
in my case…
If I fix it by adding
if (root.document && root.document.body) {
if crashes again later on (jwindow.height() call). I guess
jwindow = $(root);
on 45 line is the reason (where root is only an object
)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 20 (3 by maintainers)
@xtr0 I guess in pnotify mobile module
require('./pnotify')
is called which caused error in my code. I managed to solve this issue by changing the regex. Thank you for the clue@nathan818fr , @hperrin Can someone update npm package please? It’s seems to not have this fix =(
For anyone who has trouble with the link @sman591 suggested I had to use the following instead:
git+https://github.com/sciactive/pnotify.git#175af26286f584f33282a686191715fadae2f67b
Until a new npm version is released, I got it working with the below config (full gist):
package.json
webpack.config.js
index.js
@mazavr To workaround this issue you can do the following:
code:
webpack config:
It works for me