rsuite / validation

:sunglasses: Validate like a boss.
10 stars 4 forks source link

Cannot use import statement outside a module #1

Open DovahBrownies opened 4 years ago

DovahBrownies commented 4 years ago

I'm using the whole RSuite library in a NextJS project. I also decided to use this well-structured library but it doesn't seem to load properly on server side.

On a server side render, I get the following error: image

But on a client side render, it works perfectly.

This issue arises when I try to import the Validator: import { Validator } from '@rsuite/validation'

Any advice?

Edit: I'm honored to be the first person to create an issue in this library šŸ˜†

SevenOutman commented 4 years ago

@DovahBrownies Thank you for giving the first feedback.šŸ˜ƒ

This validation package is not well-prepared for SSR yet. Iā€™m going to resolve this and PRs are also welcome.

SevenOutman commented 4 years ago

@DovahBrownies The statement shown in you screenshot which threw the error came from source code of rsuite. This is weird because you should be using compiled rsuite instead of source code. What version of rsuite are you using?

DovahBrownies commented 4 years ago
"@rsuite/validation": "^1.2.0",
"rsuite": "^4.5.0"

@SevenOutman