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.

with-ant-design example not working with SSG on production

See original GitHub issue

Bug report

Describe the bug

Currently, the with-ant-design example just works with SSG on development. In production it throw SyntaxError: Cannot use import statement outside a module for antd components.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to this repo and clone the code. This is just a forked of the with-ant-design example with an only addition of a getStaticProps function.
  2. npm install or yarn to install dependencies.
  3. npm run build or yarn build to build the project.
  4. npm start or yarn start to run the production build.
  5. See error.

Expected behavior

The with-ant-design example should also work in production.

Screenshots

Screen Shot 2020-05-09 at 21 46 08

System information

  • OS: macOs
  • Browser: Chrome
  • Version of Next.js: 9.3.4
  • Version of Node.js: 12.13.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
cupcakearmycommented, May 24, 2020

@itsmetambui For me changing "libraryDirectory": "es" to "libraryDirectory": "lib" inside of .babelrc did the trick

0reactions
balazsorban44commented, Jan 30, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next JS: SSG not working in when passed as prop for a ...
I think that the fetched data is not being properly passed as a props to the child component when building out the production...
Read more >
Next.js No longer use SSR/SSG functions - YouTube
Next.js 13 brought a complete redesign to the Data fetching system. No more getServerSideProps or getStaticSideProps and no more separation ...
Read more >
Nextjs examples - Seba Online
The first 2. nextjs deno, Developing and shipping production-ready ... You can test it and now flickering issues is gone and you can...
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