peerigon/modernizr-loader

Module build failed

Closed this issue · 6 comments

I am getting this error:

ERROR in ./conf/.modernizrrc
Module build failed: SyntaxError: Unexpected token :
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.loaderContext.exec (/home/vshadaka/personal_html/archer/node_modules/webpack/lib/NormalModule.js:94:6)
    at Object.module.exports (/home/vshadaka/personal_html/archer/node_modules/modernizr-loader/index.js:24:26)
 @ ./src/index.js 9:0-20

My Conf modernizrrc file is:

{
  "minify": true,
  "options": [
    "domPrefixes",
    "hasEvent",
    "testAllProps",
    "testProp",
    "html5shiv",
    "setClasses"
  ],
  "feature-detects": [
    "test/history",
    "test/postmessage",
    "test/svg",
    "test/a/download",
    "test/css/transitions",
    "test/file/api",
    "test/storage/localstorage",
    "test/svg/inline"
  ]
}

Webpack Version is 2.1.0-beta.20

Hey @vivekgs2007, is this related to #35?

No This is Different Issue. I tried adding this config

{ test: /\.modernizrrc$/, loader: 'modernizr'}

Got the above error

Ok, and your modernizrrc is written in JSON? If so, you have to add the json-loader to your loader chain like this:

{ test: /\.modernizrrc$/, loader: 'modernizr-loader!json-loader' }

Still the same issue:

ERROR in ./conf/.modernizrrc
Module build failed: SyntaxError: Unexpected token ;
    at Object.parse (native)
    at Object.module.exports (/home/vshadaka/personal_html/archer/node_modules/json-loader/index.js:7:48)
 @ ./src/index.js 9:0-20

It's a slightly different error message though. Could you also add your webpack configuration file here or is it the same as in #35?

Fixed the Bug By removing the

{
  test: /\.modernizrrc(\.json)?$/,
  loader: "modernizr!json"
},