Giter Site home page Giter Site logo

Comments (10)

pugnascotia avatar pugnascotia commented on June 9, 2024 5

Hmm, so I was able to replicate and fix the reported problem in commit 2031d9c. However, that leads to a further problem, which appears to be something to do with the styled-jsx module and the lack of a document global on the server side. I'll continue looking when I get a chance, but it seems a bit obscure 😕

from next-eui-starter.

Jakkc avatar Jakkc commented on June 9, 2024 1

Aha I see! Well I have been successfully deploying a next serverless build for the past few months. It is only now after adding in elastic-ui that I am unable to compile to serverless. Fine for now, I can revert to the default next target but it would be awesome to have elastic-ui and serverless working together in the future.

Good luck with your search! 😄

from next-eui-starter.

pugnascotia avatar pugnascotia commented on June 9, 2024

Can you share a bit more about what you're trying to do when you say "compile to serverless"? Have you made any changes to the project?

from next-eui-starter.

Jakkc avatar Jakkc commented on June 9, 2024

@pugnascotia when I say compile to serverless I mean in next.config.js I am setting target: serverless. This error occurs when running the next build command.

I have not built my project directly from this boilerplate, however I have copied across all the relevant polyfills for elastic-ui from this repo, and that allows me to compile to target: server (the default next compilation target).

Please let me know anything more specific you require. Happy to provide more detail if necessary, I just don't have the node knowledge to intuitvely understand whats going on!

from next-eui-starter.

Jakkc avatar Jakkc commented on June 9, 2024

Thank you for your speedy response @pugnascotia . I will use the default next compilation target for now but I look forward to using elastic in serverless mode in the future!

from next-eui-starter.

pugnascotia avatar pugnascotia commented on June 9, 2024

So if I:

  1. Start a new app as per the docs, with
    npm init next-app nextjs-blog --example "https://github.com/vercel/next-learn-starter/tree/master/learn-starter
  2. Change it to serverless mode
  3. yarn build

Then it works OK, and styled-jsx is still in there. Which is odd.

from next-eui-starter.

Jakkc avatar Jakkc commented on June 9, 2024

Is this with elastic-ui included as well? When I try to compile to serverless target with the hotfix in your previous post, I end up with the same ReferenceError: document is not defined error you reported.

from next-eui-starter.

pugnascotia avatar pugnascotia commented on June 9, 2024

No, I was just trying to work out whether the problem exists in Next.js without EUI, or whether it is actually my problem 😁

from next-eui-starter.

pugnascotia avatar pugnascotia commented on June 9, 2024

Ah...well, the good news is that I know what the problem is now. In:

node_modules/styled-jsx/dist/lib/stylesheet.js

...there's a check for whether window is defined, before going on to reference document. Because the Next starter adds a window shim, that makes it explode. I don't know why this only happens in serverless mode though.

from next-eui-starter.

pugnascotia avatar pugnascotia commented on June 9, 2024

OK, #8 should have fixed this. Let us know how you get on.

from next-eui-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.