question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component Shadowing gives WebPack error

See original GitHub issue

In the theming section, I added a theme.js file to /src/@reflexjs/gatsby-theme-core and appended the code that was given in the tutorial section 4 “Theming”:

export default {
  colors: {
    text: "#000",
    background: "#fff",
    primary: "#07c",
  },
  fonts: {
    body: '"Segoe UI", Roboto, "Helvetica Neue", sans-serif',
    heading: "Georgia, serif",
    monospace: "Menlo, monospace",
  },
}

But, I’m somehow getting this error:



info Deleting .cache, public
info Successfully deleted directories
success open and validate gatsby-configs - 0.088s
success load plugins - 1.766s
success onPreInit - 0.022s
success initialize cache - 0.013s
success copy gatsby files - 0.088s
info content/pages directory validated.
info content/images directory validated.
info content/blocks directory validated.
info content/navs directory validated.
success onPreBootstrap - 0.054s
success createSchemaCustomization - 0.048s
success source and transform nodes - 0.668s
success building schema - 0.378s
success createPages - 0.029s
success createPagesStatefully - 0.063s
success updating schema - 0.031s
success onPreExtractQueries - 0.002s
success extract queries from components - 0.491s
success write out requires - 0.061s
success write out redirect data - 0.003s
success onPostBootstrap - 0.004s
info bootstrap finished - 8.507s
success run static queries - 0.037s - 4/4 108.29/s
success run page queries - 0.079s - 2/2 25.35/s

 ERROR 

There was an error compiling the html.js component for the development server.

See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html TypeError: Cannot read property 'preset' of undefined





  WebpackError: TypeError: Cannot read property 'preset' of undefined
  
  - build-html.js:107 doBuildPages
    [portfolio]/[gatsby]/dist/commands/build-html.js:107:24
  
  - build-html.js:121 async buildHTML
    [portfolio]/[gatsby]/dist/commands/build-html.js:121:3
  
  - develop-process.js:152 async createIndexHtml
    [portfolio]/[gatsby]/dist/commands/develop-process.js:152:7
  
  - develop-process.js:174 async startServer
    [portfolio]/[gatsby]/dist/commands/develop-process.js:174:3
  
  - develop-process.js:482 async module.exports
    [portfolio]/[gatsby]/dist/commands/develop-process.js:482:7
  

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-base@0.1.6 dev: `gatsby clean && gatsby develop`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the gatsby-starter-base@0.1.6 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/atharvakulkarni/.npm/_logs/2020-06-21T07_42_45_504Z-debug.log

What am I doing wrong here?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shadcncommented, Jun 21, 2020

Thanks. You’re probably among the first ones building with Reflex. So all feedback welcome. Feel free to reach out.

1reaction
shadcncommented, Jun 21, 2020

The default styles depend on the base preset. You can add it as follows:

import base from "@reflexjs/preset-base"

export default {
  preset: base,
  colors: {
    text: "#000",
    background: "#ff0000",
    primary: "#07c",
  },
  fonts: {
    body: 'Roboto, "Helvetica Neue", sans-serif',
    heading: "Georgia, serif",
    monospace: "Menlo, monospace",
  },
};

More in the docs: https://reflexjs.org/docs/presets#base

Let me know if this works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Component shadowing isn't working with scoped packages
The issue here is that your package directory on the filesystem ( scoped-theme ) doesn't match the package name ( @bkegley/scoped-theme ). I've ......
Read more >
Issues with Gatsby Shadowing - Stack Overflow
I want to shadow the header component, but for some reason nothing is working at all. In the lekoarts theme, the footer is...
Read more >
How Shadowing Works | Gatsby
Shadowing works by using a webpack resolver plugin that maps themes in a gatsby-config.js to possible shadowed files. This gets especially mind melty ......
Read more >
Unofficial starter site for @lekoarts /gatsby-theme-minimal-blog
I have two choices here: either shadow this component or create a new one. I go with the latter, creating my own ListingByYear...
Read more >
Shadow DOM v1 - Self-Contained Web Components
This is how shadow DOM achieves CSS style scoping. Creating shadow DOM #. A shadow root is a document fragment that gets attached...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found