GithubHelp home page GithubHelp logo

Comments (11)

flootr avatar flootr commented on June 8, 2024

Hey, thanks for reporting this issue. Could you please provide us with your webpack configuration?

from modernizr-loader.

sengeezer avatar sengeezer commented on June 8, 2024

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.

mjamesderocher avatar mjamesderocher commented on June 8, 2024

I am having a similar issue with window not being defined. I didn't use to have this problem.

from modernizr-loader.

sengeezer avatar sengeezer commented on June 8, 2024

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.

flootr avatar flootr commented on June 8, 2024

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.

flootr avatar flootr commented on June 8, 2024

Could you please test if 1.0.1 is working for you @sengeezer?

from modernizr-loader.

sengeezer avatar sengeezer commented on June 8, 2024

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.

 avatar commented on June 8, 2024

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.

cthorner avatar cthorner commented on June 8, 2024

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.

flootr avatar flootr commented on June 8, 2024

@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.

cthorner avatar cthorner commented on June 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.