Comments (11)
Hey, thanks for reporting this issue. Could you please provide us with your webpack configuration?
from modernizr-loader.
Sure. I've removed the bower line as I'm not using bower at this time.
import path from 'path';
export default {
output: {
filename: 'client-bundle.js',
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: [/node_modules/],
},
{ test: /\.json$/, loader: 'json' },
{ test: /\.modernizrrc$/, loader: 'modernizr' },
{
test: /\.modernizrrc(\.json)?$/,
loader: 'modernizr!json',
},
],
},
resolve: {
extensions: ['', '.js', '.jsx'],
modulesDirectories: [
'node_modules',
],
alias: {
modernizr$: path.resolve(__dirname, './.modernizrrc'),
},
},
};
from modernizr-loader.
I am having a similar issue with window not being defined. I didn't use to have this problem.
from modernizr-loader.
Ok, I've played around some more and have changed my webpack config to this:
import path from 'path';
export default {
output: {
library: 'MF',
libraryTarget: 'umd',
filename: 'client-bundle.js',
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: [/node_modules/],
},
{ test: /modernizr-config$/, loader: 'modernizr' },
{
test: /modernizr-config(\.json)?$/,
loader: 'modernizr!json',
},
],
},
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
modulesDirectories: [
'node_modules',
],
alias: {
modernizr$: path.resolve(__dirname, './vendor/modernizr-config'),
},
},
};
I can now have if(Modernizr.input.placeholder)
evaluate to true, for example. Does that mean it's working? This may seem like a silly question, but I may have gone codeblind on this topic.
from modernizr-loader.
Does that mean it's working?
Yes and no. The Modernizr test for input.placeholder
does not rely on the global window
object itself. I'm working on a fix!
from modernizr-loader.
Could you please test if 1.0.1
is working for you @sengeezer?
from modernizr-loader.
Ok, I updated to the new version and added test/elem/picture
to the rc file. Upon running, I get the css classes in the body tag and the test for Modernizr.picture
passes.
As far as I can tell, picture does use window. If this does mean that it's working now, I'd like to point out that formatting of the rc file, which in my case is an output from modernizr's json generator, appears to be critical.
from modernizr-loader.
Hello,
I confirm that window is not accessible within the tests, making stuff like touchevents test broken.
E.g.
define(['Modernizr', 'prefixes', 'testStyles'], function(Modernizr, prefixes, testStyles) {
// Chrome (desktop) used to lie about its support on this, but that has since been rectified: http://crbug.com/36415
Modernizr.addTest('touchevents', function() {
console.warn('DEBUG');
console.log(window);
console.log(document);
var bool;
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
bool = true;
} else {
// include the 'heartz' as a way to have a non matching MQ to help terminate the join
// https://git.io/vznFH
var query = ['@media (', prefixes.join('touch-enabled),('), 'heartz', ')', '{#modernizr{top:9px;position:absolute}}'].join('');
testStyles(query, function(node) {
bool = node.offsetTop === 9;
});
}
return bool;
});
});
window return an object with Modernizr inside only.
from modernizr-loader.
We ran into this issue as well. v1.0.0 was giving us an empty object instead of window. Upgrading to v1.0.1 of modernizr-loader fixes the issue. However, the repo is still showing v1.0.0 as being the latest release. Can you update it to show v1.0.1 as latest release, @flootr ?
Thanks!
from modernizr-loader.
@cthorner Can you tell me where you see/don't see this? 1.0.1 should be the latest release both on GitHub and npm.
from modernizr-loader.
When I go to releases in github, it shows "Latest Release" button next to the 1.0.0 release. I also see 1.0.1, but it is not marked as "Latest Release". Does that make sense? Another way to get there is to go to the latest url: https://github.com/peerigon/modernizr-loader/releases/latest
Right now it is redirecting to 1.0.0.
from modernizr-loader.
Related Issues (20)
- the code `delete window.Modernizr` will throw an error in IE8 HOT 1
- Config from readme gives "path is not defined" HOT 2
- The modernizr-loader does not work with karma-webpack HOT 3
- Module build failed HOT 6
- Error in webpack Build HOT 26
- Error when parsing modernizrrc HOT 5
- Uncaught TypeError: _modernizr2.default.mq is not a function HOT 2
- json-loader is not required for webpack v2 and above HOT 1
- SyntaxError: Unexpected token : HOT 17
- specific chunk
- Pleas update npm docs!
- Add support for webpack 4 HOT 11
- [Docs] Installing modernizr package
- detection of keyframes does not work HOT 1
- No Such File or Directory HOT 1
- Build errors: dependencies not found HOT 2
- Is this project deprecated? HOT 4
- Dependency not found
- Not working with webpack@^5.0.0 HOT 5
- modernizr-loader does not work with json5-loader@4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modernizr-loader.