doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.59k stars 1.46k forks source link

docz-plugin-css not working in 1.0.1 [with workaround] #793

Closed ivan-dalmet closed 4 years ago

ivan-dalmet commented 5 years ago

Bug report

docz-plugin-css (0.11.0) make docz (1.0.1) crash :(

image

SCSS Workaround ;)

yarn add style-loader css-loader sass-loader node-sass

Replace the docz-plugin-css call in your doczrc.js with:

export default {
  // ...
  onCreateWebpackChain: (config) => {
    // Allow SCSS imports
    config.module
      .rule('scss')
      .test(/\.css|scss|sass$/)
      .use('style')
      .loader('style-loader')
      .end()
      .use('css')
      .loader('css-loader')
      .end()
      .use('sass')
      .loader('sass-loader')
      .end();
  },
  // ...
};

CSS only Workaround ;)

yarn add style-loader css-loader

Replace the docz-plugin-css call in your doczrc.js with:

export default {
  // ...
  onCreateWebpackChain: (config) => {
    // Allow CSS imports
    config.module
      .rule('scss')
      .test(/\.css|scss|sass$/)
      .use('style')
      .loader('style-loader')
      .end()
      .use('css')
      .loader('css-loader')
      .end();
  },
  // ...
};
upteran commented 5 years ago

@ivan-dalmet It crashed only when you add docz-plugin-css? I had the same problem with 'expirationTime' when updated docz to 1.0.1, exactly with hooks and react-hot-loader, and it fixed by update 'react-hot-loader' to 4.8 more: https://github.com/facebook/react/issues/14767 mby it help

ivan-dalmet commented 5 years ago

Yes only docz-plugin-css. May be it use react-hot-loader.

mrmos commented 5 years ago

It does not, but it depends on docz-core which does rely on react-hot-loader, and has not been updated to the latest version in docz-plugin-css

I was able to resolve this by adding the latest version of react-hot-loader as a dev dependency to my docz project. Didn't have to remove the CSS plugin

$ yarn add react-hot-loader@latest --dev
udimberto commented 5 years ago

It does not, but it depends on docz-core which does rely on react-hot-loader, and has not been updated to the latest version in docz-plugin-css

I was able to resolve this by adding the latest version of react-hot-loader as a dev dependency to my docz project. Didn't have to remove the CSS plugin

$ yarn add react-hot-loader@latest --dev

Works for me here, in Ingresse's Aphrodite React. (Under reconstruction)

Thank you, @mrmos