Search code examples
webpackwebpack-2

How to find out which loader is causing this warning: 'loaderUtils.parseQuery() received a non-string value which can be problematic'


I have recently upgrade webpack to v2.x. One of the loader is giving out this warning:

    Trace: loaderUtils.parseQuery() received a non-string value which can be 
problematic, see https://github.com/webpack/loader-utils/issues/56
    parseQuery() will be replaced with getOptions() in the next major version of
 loader-utils.

I have updated all the loader to the latest version but this warning remains. How can I identify the offending loader?


Solution

  • Add this line to the webpack.config.js

    process.traceDeprecation = true
    

    it will print out the stacktrace

    Trace: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
    parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
        at Object.exports._printDeprecationMessage (internal/util.js:30:13)
        at deprecated (internal/util.js:54:22)
        at Object.parseQuery (/Users/antkong/dev/project/node_modules/loader-utils/index.js:78:3)
        at Object.module.exports (/Users/antkong/dev/project/node_modules/postcss-loader/index.js:46:30)
        at LOADER_EXECUTION (/Users/antkong/dev/project/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
        at runSyncOrAsync (/Users/antkong/dev/project/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
        at iterateNormalLoaders (/Users/antkong/dev/project/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
        at iterateNormalLoaders (/Users/antkong/dev/project/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
        at /Users/antkong/dev/project/node_modules/loader-runner/lib/LoaderRunner.js:233:3
        at context.callback (/Users/antkong/dev/project/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    

    From the stacktrace I can see the warning is caused by postcss-loader