Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with Webpack build #5

Closed
dcalhoun opened this issue Apr 7, 2016 · 3 comments
Closed

Errors with Webpack build #5

dcalhoun opened this issue Apr 7, 2016 · 3 comments

Comments

@dcalhoun
Copy link

dcalhoun commented Apr 7, 2016

I'm having difficulties getting modernizr-loader setup. I followed the README, but unfortunately hit a lot of errors anytime I attempt to import Modernizr from 'modernizr'. Any thoughts as to what is going on here? Thanks!

Errors

Full list of errors

ERROR in ./~/modernizr/lib/build.js
Module not found: Error: Cannot resolve module 'generate' in /Users/username/Sites/web/gn-join/node_modules/modernizr/lib
 @ ./~/modernizr/lib/build.js 151:2-72

[...]

Config

// webpack.config.js
var path = require('path')

module.exports = {
  entry: path.join(__dirname,'./src/index.js'),

  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: 'assets'
  },

  module: {
    loaders: [
      { test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
      { test: /\.json$/, loader: 'json' },
      { test: /\.modernizrrc$/, loader: 'modernizr'}
    ]
  },

  resolve: {
    modernizr$: path.resolve(__dirname, '.modernizrrc')
  }
}
# .modernizrrc
{
  "minify": true,
  "options": [
    "setClasses"
  ],
  "feature-detects": [
    "test/touchevents"
  ]
}

Peer Dependency Versions

  • webpack@1.12.14
  • modernizr@3.3.1
@flootr
Copy link
Contributor

flootr commented Apr 8, 2016

You might have an error in your webpack config. Please provide modernizr as an alias in the resolve part. That's missing in your configuration:

resolve: {
    alias: {
      modernizr$: path.resolve(__dirname, "path/to/.modernizrrc")
    }
  }

@dcalhoun
Copy link
Author

dcalhoun commented Apr 8, 2016

@flootr yep, I was afraid it was a simple mistake. Sorry for wasting your time. Thank you for the assistance!

@dcalhoun dcalhoun closed this as completed Apr 8, 2016
@vivekgs2007
Copy link

Got the same Issue.

Changed as mentioned by @flootr but still no Luck;.

Webpack: v2.1.0-beta.20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants