codebandits / react-app-rewire-css-modules

MIT License
69 stars 51 forks source link

TypeError: Cannot destructure property `index` of 'undefined' or 'null'. #4

Closed 001123 closed 6 years ago

001123 commented 6 years ago

I got error

This is my overwrite config

/* config-overrides.js */
const {
  injectBabelPlugin
} = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');
const rewireCssModules = require('react-app-rewire-css-modules');

module.exports = function override(config, env) {
  config = rewireCssModules(config, env);
  //do stuff with the webpack config...
  config = injectBabelPlugin(['import', {
    libraryName: 'antd',
    style: true
  }], config); // change importing css to less

  config = rewireLess.withLoaderOptions({
    modifyVars: {
      "@primary-color": "#fa4169"
    },
  })(config, env);

  return config;
}
horizon0514 commented 6 years ago

I had the error too. And if use Node v6.0 , it's OK. I'm still working on it.

skreborn commented 6 years ago

This seems to be solved by applying #2.

horizon0514 commented 6 years ago

@skreborn it didn't work for me

DBingo commented 6 years ago

@skreborn yeah, it can be solved. But the code is still waiting to be merged. I have to change the source code according to #2 . It's inconvenient.

zzsoszz commented 6 years ago

i am waiting to be merged

lnhrdt commented 6 years ago

Thank you @001123 for reporting this issue and to everyone else for commenting as well.

The fix in #2 has been merged. I only develop on *nix. Can someone test the latest version on Windows and report back if the issue is resolved for you?

unconfident commented 6 years ago

Thank you for resolving this.

Can someone test the latest version on Windows and report back if the issue is resolved for you?

Can confirm, it's fixed. Crashes on ce107750a3 (pre-patch), works as intended on 956a2330c2 (current).

tantaiMoon commented 6 years ago

How to solve this problem, I can't understand its final solution.