Comments (11)
It works now! Thank you very much.
from intl-tel-input.
@jackocnr
Hey!
I updated to v21.1.1 and it is working like a charm now. Thanks!
from intl-tel-input.
Thanks for reporting this. Unfortunately, I cannot reproduce the issue - I just created a new Next.js project with npx create-next-app@latest
(which uses Next.js v14.1.4) and then did npm install --save intl-tel-input
and then imported the plugin with import IntlTelInput from "intl-tel-input/react"
and it works fine for me. I do get a linting error saying "Could not find a declaration file for module 'intl-tel-input/react'" (this is a known issue) but the dev build works fine and successfully displays the plugin on the page. (Fixed in v21.0.6)
Some questions for you:
- What version of Next.js are you using? (and Node version too)
- Can you share your Next config
- And your TSconfig as well
- And any custom Webpack config too if you have one
from intl-tel-input.
In v21.0.6 I've fixed the "Could not find a declaration file" error.
from intl-tel-input.
Thanks for reporting this. Unfortunately, I cannot reproduce the issue - I just created a new Next.js project with
npx create-next-app@latest
(which uses Next.js v14.1.4) and then didnpm install --save intl-tel-input
and then imported the plugin withimport IntlTelInput from "intl-tel-input/react"
and it works fine for me.I do get a linting error saying "Could not find a declaration file for module 'intl-tel-input/react'" (this is a known issue) but the dev build works fine and successfully displays the plugin on the page.(Fixed in v21.0.6)Some questions for you:
- What version of Next.js are you using? (and Node version too)
- Can you share your Next config
- And your TSconfig as well
- And any custom Webpack config too if you have one
Thanks for looking into it. Here is the specific info:
- Next.js v13.2.4
- Node v21.6.2
- next.config.js
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
if (
process.env.LD_LIBRARY_PATH == null ||
!process.env.LD_LIBRARY_PATH.includes(
`${process.env.PWD}/node_modules/canvas/build/Release:`
)
) {
process.env.LD_LIBRARY_PATH = `${
process.env.PWD
}/node_modules/canvas/build/Release:${process.env.LD_LIBRARY_PATH || ""}`;
}
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: false,
},
images: {
domains: [
"cloudflare-ipfs.com",
"gcqrvlegvyiunwewkuoz.supabase.co",
"ordynhmcwwnczgnvuomz.supabase.co",
],
},
output: "standalone",
webpack: (config) => {
config.mode = "production";
config.module.rules.push({
test: /\.pdf/,
type: "asset/resource",
generator: {
filename: "static/[hash][ext]",
},
});
return config;
},
async redirects() {
return [
{
source: "/onboarding",
destination: "/onboarding/region-screen",
permanent: true,
},
{
source: "/profile",
destination: "/patient-portal/profile",
permanent: true,
},
{
source: "/update-payment",
destination: "/patient-portal/profile/update-payment",
permanent: true,
},
];
},
};
module.exports = withBundleAnalyzer(nextConfig);
- tsconfig.json
{
"compilerOptions": {
"target": "es2015",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"src/types",
"additional.d.ts",
"global.d.ts",
"src/pages/_document.tsx"
],
"exclude": ["node_modules"]
}
- webpack 5.76.0
I just installed the latest version v21.0.6. The error in the first screenshot still persists, but the error in the second screenshot is gone.
When I do npm run dev
, I received the following error
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1290:20)
at Module._compile (node:internal/modules/cjs/loader:1342:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
at Module.load (node:internal/modules/cjs/loader:1212:32)
at Module._load (node:internal/modules/cjs/loader:1028:12)
at Module.require (node:internal/modules/cjs/loader:1237:19)
at require (node:internal/modules/helpers:176:18)
at 8598 (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:1346:18)
at __webpack_require__ (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///6692:32:79)
at __webpack_require__.a (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:97:13)
at eval (webpack-internal:///6692:1:21)
at 6692 (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:304:1)
at __webpack_require__ (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:33:42)
at /Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:317:77
at __webpack_require__.a (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:97:13)
at 467 (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:312:21)
at __webpack_require__ (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///8933:10:88)
at __webpack_require__.a (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:97:13)
at eval (webpack-internal:///8933:1:21)
at 8933 (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:296:1)
at __webpack_require__ (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:33:42)
at /Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:335:73
at __webpack_require__.a (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:97:13)
at 4937 (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:330:21)
at __webpack_require__ (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///3751:11:92)
at __webpack_require__.a (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:97:13)
at eval (webpack-internal:///3751:1:21)
at 3751 (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:1054:1)
at __webpack_require__ (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/webpack-runtime.js:33:42)
at __webpack_exec__ (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:2492:39)
at /Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:2493:28
at Object.<anonymous> (/Users/qinfengwu/WebstormProjects/frontend-next/.next/server/pages/onboarding/complete-profile.js:2496:3)
at Module._compile (node:internal/modules/cjs/loader:1378:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
at Module.load (node:internal/modules/cjs/loader:1212:32)
at Module._load (node:internal/modules/cjs/loader:1028:12)
at Module.require (node:internal/modules/cjs/loader:1237:19)
at require (node:internal/modules/helpers:176:18)
at Object.requirePage (/Users/qinfengwu/WebstormProjects/frontend-next/node_modules/next/dist/server/require.js:88:12)
at /Users/qinfengwu/WebstormProjects/frontend-next/node_modules/next/dist/server/load-components.js:49:73
at async Object.loadComponentsImpl [as loadComponents] (/Users/qinfengwu/WebstormProjects/frontend-next/node_modules/next/dist/server/load-components.js:49:26)
at async DevServer.findPageComponentsImpl (/Users/qinfengwu/WebstormProjects/frontend-next/node_modules/next/dist/server/next-server.js:600:36) {
page: '/onboarding/complete-profile'
}
from intl-tel-input.
also installed "@types/intl-tel-input": "^18.1.4" and imported "intl-tel-input/build/js/types.d.ts"
You shouldn't need either of these any more - can you try removing them both and see if that changes anything?
from intl-tel-input.
Getting the same issues in a react 18x app.
Installed the package via npm install intl-tel-input --save
.
Cannot import intl-tel-input/react, but intl-tel-input works fine.
I did not install any types.
Most likely it is caused by the v21.0.8. I downgraded to x.x.6 and it seems to be working.
from intl-tel-input.
Thanks for reporting @b4ry. Are you also using Typescript? Which version? And can you share your tsconfig?
And @qinfengwu90 which version of Typescript are you using?
from intl-tel-input.
also installed "@types/intl-tel-input": "^18.1.4" and imported "intl-tel-input/build/js/types.d.ts"
You shouldn't need either of these any more - can you try removing them both and see if that changes anything?
I removed those and it didn't change anything.
The Typescript version is 4.9.5
from intl-tel-input.
@qinfengwu90 @b4ry can you please try updating to v21.1.1 (and make sure you Cmd+Shift+p => reload window) and see if that fixes your issue.
from intl-tel-input.
I'll close this issue for now, but @b4ry do let me know if you're still having problems.
from intl-tel-input.
Related Issues (20)
- intlTelInput.d.ts is not a module. HOT 5
- Cannot find module 'react' HOT 2
- .isValidNumber() result diferent from .isValidNumber() from google phone library HOT 2
- On geoIpLookup success, countrychange event fires only for the first iti instance HOT 1
- SyntaxError: Cannot use import statement outside a module HOT 2
- Force to use the prefix HOT 5
- Proposal: include translations HOT 3
- ES5 Support on AngularJS App HOT 5
- setNumber not setting the phone Number
- Advise: Multiple instances of intl-tel-input getting loaded, causing global "window" collision HOT 5
- can you exclude the "Unknown" country from the input? HOT 7
- [Question] Is Bower still used? HOT 1
- Console error when using browser autofill HOT 2
- [FUN] intl-tel-input in the wild HOT 4
- [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
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.