-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Baklava With NextJS #508
Comments
This is probably because we use ESM bundles for Baklava. Maybe you can check how to use ESM packages in Next.js. For the SSR: We didn't try SSR yet, but Lit has some tools for SSR: https://www.npmjs.com/package/@lit-labs/ssr We have an on-going issue about SSR: #334. I don't know if @leventozen can add anything for now? |
@BerkinAKKAYA I believe this problem may be solved with #570 which is released with v2.1.0-beta.7. Can you try with that version? |
Hi @muratcorlu, the error is changed! It works when i go to the page i use Baklava from homepage, but if i reload the page i get the error "ReferenceError: customElements is not defined" 😔 |
Do you import <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@trendyol/baklava@2.0.0/dist/themes/default.css" />
<script type="module" src="https://cdn.jsdelivr.net/npm/@trendyol/baklava@2.0.0/dist/baklava.js"></script> PS: Baklava React wrappers that you import from |
And which version do you use currently? |
Describe the bug
We get the error
SyntaxError: Cannot use import statement outside a module
in our Next project. It acts like we didn't import the CDN, but only if we go to that page directly or refresh the page. It works if we navigate to that page from another page.For example the Users page is using Baklava but the Home page does not. If i first go to the Home and the navigate to Users, it works. If i refresh the page or directly go to /users, it gives the error.
Solutions We Tried
export default dynamic(() => Promise.resolve(App), { ssr: false })
strategy='beforeInteractive'
,To Reproduce
yarn add @trendyol/baklava@beta
Screenshots
The text was updated successfully, but these errors were encountered: