Comments (10)
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.
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.
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.
@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.
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.
So if I:
- 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
- Change it to
serverless
mode yarn build
Then it works OK, and styled-jsx
is still in there. Which is odd.
from next-eui-starter.
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.
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.
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.
OK, #8 should have fixed this. Let us know how you get on.
from next-eui-starter.
Related Issues (20)
- Initial thoughts HOT 18
- Error using EuiHeaderBreadcrumbs
- Overriding default themes HOT 1
- CodeBlock not render properly (Colors)! HOT 4
- Warning: Did not expect server HTML to contain a <path> in <svg>. HOT 4
- Update to EUI version 31 HOT 1
- Bad-precaching-response with themes/min.css when trying to use EUI next.js Starter for PWA HOT 3
- Any Plans to Deprecate React Ace and Migrate to Next JS 11 ? (Webpack 5) HOT 5
- Incompatible with Nextjs 5 HOT 5
- Please update the starter template with eui 23.1.0 HOT 2
- Modules that import @elastic/eui are failing
- Cross Ref: Error 'Document is not defined...'
- EuiNavDrawer isLocked prop does not shift main content to the right HOT 5
- Inconsistent link opening on the home page HOT 1
- CodeSandbox template doesn't work HOT 1
- Add new help page - How we prototype at Elastic
- regeneratorRuntime is not defined HOT 1
- Flash of unstyled content when loading from server HOT 16
- Flash of unstyled content HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-eui-starter.