webpack-contrib / json-loader

json loader module for webpack - UNMAINTAINED

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled Promise Rejection Warning

kevinSuttle opened this issue · comments

Preface: there's a lot going on here. :/

I tried to be clever and use the package name as a CSS Prefix with @thompsongl's https://github.com/thompsongl/postcss-class-prefix.

"postcss-class-prefix": "^0.3.0",
"postcss-loader": "^0.13.0",
"json-loader": "^0.5.4",
"webpack": "^2.1.0-beta.25"
$ webpack --progress -p

 15% building modules 42/55 modules 13 active ...de_modules/css-loader/lib/css-base.js(node:73866) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Module '/Users/kevinSuttle/Code/ui-primitives-react/node_modules/json-loader/index.js' is not a loader (must have normal or pitch function)
 21% building modules 94/95 modules 1 active ...Code/ui-primitives-react/package.json

$ nvm current
v6.7.0

webpack.config.js

const pkg = require('./package.json'); 
const CssClassPrefix = `${pkg.name.split('/')[1]}_`;

// require(!json.package.json) results in
// Error: Cannot find module 'json!./package.json'

// ...
 new webpack.LoaderOptionsPlugin({
        options: {
          postcss: function (webpack) {
            return [
              require('postcss-import')({
                addDependencyTo: webpack,
              }),
              customProperties(),
              cssApply,
              autoprefixer,
              postCSSPrefix(CssClassPrefix),
            ]
          },
        },
      }

Even tried the suggestions in webpack-contrib/css-loader#145 of adding require('es6-promise') at the top of webpack.config.js, but no dice.

Seems like a race condition, but I can't be sure.

Are you trying to use the json-loader in your webpack config? If so, that's not possible.

No. We ended up having to move on, unfortunately.

@kevinSuttle Reopen or make a new issue if there are still any regressions Thx 😛