-
-
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
utilsScript fails to load the utils from CDN in Next.js app #1616
Comments
The utilsScript value is incorrect - it is pointing to the plugin script - instead it needs to point to the utils script e.g. |
We're getting a similar issue with the recent changes to the
We use the exact URL in your comment above 🤔 |
Ah yeah my bad :D. Still though, same error is showing up |
@erisleci can you reproduce this issue in a codepen? Here is a React pen you can fork if that helps. @carlssonemil can you create a new issue for that, and give more details about what tech you're using (with versions), and any relevant config files etc please. |
I've just done a quick test and I can reproduce this error. Clicking through to see which line is causing the error, I see that webpack is replacing the dynamic import call with |
If anyone has any experience with / thoughts on the above then please do share, but otherwise, you can just do |
@jackocnr the following pre-bundled version does work -
but it also shows a similar webpack warning as @carlssonemil mentioned, just with a different pathname.
|
@BRAiNCHiLD95 that's strange, I can't reproduce that issue with Next v14.1.4. What version of Next are you using? And are you still using the utilsScript option? (you don't need to if you're using the reactWithUtils bundle) |
Sorry I forgot to mention that - I'm actually using this with React 18.3.1 - came across this since it broke on our staging servers (we were using the latest cdn link, but not the latest package). Found this issue, updated to the latest, and got these webpack warnings. Funnily enough, the same code works just fine when used in a codepen. But webpack does not like the dynamic Update:
Confirmed that the webpack warnings show up even if utilsScript is not passed to the config object. |
@BRAiNCHiLD95 that should now be fixed in v23.0.5 - can you confirm? @erisleci I'm hoping v23.0.5 fixes your issue as well - can you confirm? |
@jackocnr confirmed - this fixed both the issues! v23.0.5 works with both -
and
Not sure if the CDN link needs to be updated to match the version, but it definitely works with the 23.0.4 links |
@jackocnr Yes, the issue is fixed. Thank you |
Ahh that version link didn't work some time ago, anyhoo looks like it's all back up and running! |
The new version seems to break the ability to import the util scripts from CDN on a Next app.
Plugin version
v23.0.4
Steps to reproduce
Install intl-tel-input on a Next app (v14.2.2)
Render the IntlTelInput react component and pass utilsScript inside initOptions param:
initOptions={{ utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/23.0.4/js/intlTelInput.min.js", }}
Check browser console
Expected behaviour
Util scripts load
Actual behaviour
Util scripts fail to load and it shows this error
Initialisation options
utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/23.0.4/js/intlTelInput.min.js"
The text was updated successfully, but these errors were encountered: