davidgovea / webpack-intro

Introduction/demo for webpack, the excellent browser-based module system
http://cuttleblog.tumblr.com/post/63669845272/webpack
6 stars 1 forks source link

Error: Cannot read property 'documentElement' of undefined #2

Open fernandoacorreia opened 10 years ago

fernandoacorreia commented 10 years ago

After running make and opening the page in a browser, there is this JavaScript Error:

Uncaught TypeError: Cannot read property 'documentElement' of undefined bundle.js:180

The error happens at this line in Modernizr:

docElement = document.documentElement

The Modernizr function is called with a parameter of this.document that, in the bundled script, is undefined.

farmermike commented 10 years ago

I got this to work by:

npm install imports-loader --save

and then:

require('imports?this=>window!./app/bower_components/modernizr/modernizr.js');

kholisabdullah commented 6 years ago

For new version of imports-loader, use

require('imports-loader?this=>window!./app/bower_components/modernizr/modernizr.js');

youmakr commented 5 years ago

where do I import thus loader