-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
SyntaxError: Cannot use import statement outside a module #1565
Comments
Thanks for reporting. This should be fixed in v21.1.2 - can you give it a try and let me know? |
Closing due to inactivity. |
I'm also still seeing this (with Remix v^2.9.1). This version of Remix uses Vite under the hood at v^5.1.0 so I'm using a bundler. I'm on v^23.1.0 of intl-tel-input but I also tried v21.1.1 and that sadly had the same error! I'm encountering the following (this is within a route called "login.tsx"):
My Here is how I am importing and using // at the top of the file, last after a bunch of other unrelated imports
import IntlTelInput from 'intl-tel-input/react';
import 'intl-tel-input/styles';
// ... after a bunch of boilerplate and types, I just use IntlTelInput as a component in the body of the route's component like so
<div className="label">
<span className="label-text">Phone Number</span>
</div>
<div className="input input-bordered w-full">
<IntlTelInput />
</div> This component is sometimes rendered with SSR (which is very preferable since it is almost the entire route's worth of stuff)! I really hope we can get to the bottom of this, as I think this library looks really awesome and perfect for my use-case! 😄 Let me know if you need a reproduction, I don't want to have to make one (there's a lot of stuff in the repo) but if it's really necessary I can do it! |
I wonder if this is being caused by the dynamic import we're using. Could you try commenting out that whole import statement (in your node_modules/intl-tel-input/react/build/IntlTelInput.js) and see if that fixes the issue? (maybe also try completely emptying this file, and rebuilding, to see if the changes to the file are even being picked up?) |
Also, with the way the react component works, I really don't think SSR will work anyway, so I would say you'll need to disable SSR for this component. |
I'll try that out later and report back! Thank you |
Just as an update, I still plan to try it out - I've just been busy! Thank you again |
I know you're planning to review this, but as I said, the way this component works (as a wrapper around the JavaScript plugin), it's really not going to play well with SSR, so I think SSR just needs to be disabled in this case. Closing this for now. |
Steps to reproduce
npm run dev
in Next.js v13.2.4The text was updated successfully, but these errors were encountered: