Gatsby: _styledComponents.ServerStyleSheet não é um erro de construtor

Criado em 14 dez. 2017  ·  3Comentários  ·  Fonte: gatsbyjs/gatsby

Descrição

Estou recebendo este erro de webpack ao executar yarn deploy para minha página do github.

"deploy": "gatsby build --prefix-paths && gh-pages -d public",

error Building static HTML for pages failed`

`See our docs page on debugging HTML builds for help https://goo.gl/yL9lND`

  `16 |       setHeadComponents = _ref.setHeadComponents;
  17 |
> 18 |   var sheet = new _styledComponents.ServerStyleSheet();
     | ^
  19 |
  20 |   var app = _react2.default.createElement(
  21 |     _styledComponents.StyleSheetManager,`


`WebpackError: _styledComponents.ServerStyleSheet is not a constructor`

  - gatsby-ssr.js:18 Object.exports.replaceRenderer
    ~/gatsby-plugin-styled-components/gatsby-ssr.js:18:1

  - api-runner-ssr.js:23
    .cache/api-runner-ssr.js:23:41


  - api-runner-ssr.js:21 module.exports
    .cache/api-runner-ssr.js:21:25

  - static-entry.js:113 module.exports
    .cache/static-entry.js:113:3

  - static-entry.js:99 Function.Promise.fromNode.Promise.fromCallback
    .cache/static-entry.js:99:20





error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Estou usando gatsby-plugin-styled-components: "2.0.2" e styled-components: "2.2.4" .

gatsby-pluging-styled-components deveriam ter tratado o SSR certo? ou ainda tenho que configurá-lo manualmente? funcionou bem alguns meses atrás, quando implantei a primeira versão da minha página do github.

Comentários muito úteis

Para quem vem aqui do google ....
certifique-se de que @ material-ui / core / styles realmente exporte ServerStyleSheets

isso me levou a perceber que estou executando um material-ui / core mais antigo (3.9.x)
corrigido ao atualizar para 4.5.1

Todos 3 comentários

O problema pode ser fechado. Percebi isso porque não instalei a dependência de pares para componentes estilizados.

@jaanhio Você pode explicar como resolveu isso? Eu também estou recebendo o mesmo tipo de erro.

TypeError: _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_10__.ServerStyleSheets is not a constructor
    at eval (webpack:///./server/helpers/renderer.js?:37:16)
    at eval (webpack:///./server/index.js?:54:81)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Para quem vem aqui do google ....
certifique-se de que @ material-ui / core / styles realmente exporte ServerStyleSheets

isso me levou a perceber que estou executando um material-ui / core mais antigo (3.9.x)
corrigido ao atualizar para 4.5.1

Esta página foi útil?
0 / 5 - 0 avaliações

Questões relacionadas

benstr picture benstr  ·  3Comentários

signalwerk picture signalwerk  ·  3Comentários

totsteps picture totsteps  ·  3Comentários

timbrandin picture timbrandin  ·  3Comentários

andykais picture andykais  ·  3Comentários