Comments (13)
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 __webpack_require__(...)
so it's trying to do something clever, but actually breaking the import. I wonder if there's a next/webpack configuration setting to tell webpack to leave dynamic imports untouched, ideally specifically within this library.
from intl-tel-input.
We're getting a similar issue with the recent changes to the utilsScript
option. Webpack throws a warning for the dynamic import of the script URL with the following message:
Critical dependency: the request of a dependency is an expression
We use the exact URL in your comment above 🤔
from intl-tel-input.
@jackocnr Yes, the issue is fixed. Thank you
@BRAiNCHiLD95 https://cdn.jsdelivr.net/npm/[email protected]/build/js/utils.js this is the new link it seems
from intl-tel-input.
The utilsScript value is incorrect - it is pointing to the plugin script - instead it needs to point to the utils script e.g. https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/23.0.4/js/utils.js
from intl-tel-input.
@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.
from intl-tel-input.
@jackocnr confirmed - this fixed both the issues!
v23.0.5 works with both -
import IntlTelInput from "intl-tel-input/react"
const utilsScriptURL = https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/23.0.4/js/utils.js
and
import IntlTelInput from "intl-tel-input/reactWithUtils"
Not sure if the CDN link needs to be updated to match the version, but it definitely works with the 23.0.4 links
from intl-tel-input.
The utilsScript value is incorrect - it is pointing to the plugin script - instead it needs to point to the utils script e.g.
https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/23.0.4/js/utils.js
Ah yeah my bad :D. Still though, same error is showing up
from intl-tel-input.
If anyone has any experience with / thoughts on the above then please do share, but otherwise, you can just do import IntlTelInput from "intl-tel-input/reactWithUtils"
instead, which comes pre-bundled with the utils. The downside is that the utils script is aprx 260kb (unzipped), but I figure if you're already lazy loading the plugin chunk then that doesn't really matter. What do people think?
from intl-tel-input.
@jackocnr the following pre-bundled version does work -
import IntlTelInput from "intl-tel-input/reactWithUtils"
but it also shows a similar webpack warning as @carlssonemil mentioned, just with a different pathname.
Just to confirm this, I tried 2 different imports in 2 components -
import IntlTelInput from "intl-tel-input/react"
WARNING in ./node_modules/intl-tel-input/react/build/IntlTelInput.js 1:33234-33243
Critical dependency: the request of a dependency is an expression
import IntlTelInput from "intl-tel-input/reactWithUtils"
WARNING in ./node_modules/intl-tel-input/react/build/IntlTelInputWithUtils.js 1:33267-33276
Critical dependency: the request of a dependency is an expression
from intl-tel-input.
@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)
from intl-tel-input.
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 import(<utilsscript>).then()
, I believe.
Update:
And are you still using the utilsScript option? (you don't need to if you're using the reactWithUtils bundle)
Confirmed that the webpack warnings show up even if utilsScript is not passed to the config object.
from intl-tel-input.
@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?
from intl-tel-input.
@jackocnr Yes, the issue is fixed. Thank you
@BRAiNCHiLD95 https://cdn.jsdelivr.net/npm/[email protected]/build/js/utils.js this is the new link it seems
Ahh that version link didn't work some time ago, anyhoo looks like it's all back up and running!
from intl-tel-input.
Related Issues (20)
- [Feature Request] Dark mode on documentation. HOT 4
- Translated country name is passed in few instances HOT 2
- Typescript definitions wrong with 21.2.6 HOT 9
- InitialValue in react component does not set the number and country state values. HOT 2
- Unable to resolve path to module 'intl-tel-input/react' HOT 8
- isValidNumber not working when util.js is pre-loaded (not lazy loaded) in v22.0.2 HOT 6
- Demo with javascript locacles HOT 4
- Arabic locale HOT 6
- Invalid country data for French overseas territories HOT 2
- Convert flags.png to AVIF format to comply with PageSpeed Insights recommendation HOT 7
- New Country to be added => Artsakh | 374 47, 374 97 HOT 2
- U.S. is not showing the u.s. flag HOT 10
- Dark Mode Support HOT 2
- Question about strictMode HOT 3
- Validation doesn't work for some phone numbers from Germany HOT 2
- This input doesn't work on two elements HOT 3
- Getting error while using utilsScript HOT 6
- React component - allow access to intlTelInput instance HOT 14
- [Webpack] Compilation warning when initializing `intlTelInput` with `utilsScript` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intl-tel-input.