Skip to content
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 #7

Open
rohankm opened this issue Dec 21, 2022 · 10 comments · May be fixed by #9
Open

SyntaxError: Cannot use import statement outside a module #7

rohankm opened this issue Dec 21, 2022 · 10 comments · May be fixed by #9

Comments

@rohankm
Copy link

rohankm commented Dec 21, 2022

Hi,
im trying to import the datepicker in nextjs and im getting this error.
SyntaxError: Cannot use import statement outside a module

@MEddarhri
Copy link

Same issue here

@manufarez
Copy link

Same issue in Rails 7. I think it's because package.json needs a "type": "module" statement.

I was able to make it work using Flowbite's CDN but it's a bit of a hack, because it's not instantiating Datepicker when I want it to.

@markjaquith markjaquith linked a pull request Dec 29, 2022 that will close this issue
@xiaohanyu
Copy link

Same issue here.

I've tried to manually modify package.json with a "type": "module" however it's not working.

@git-init-wesley
Copy link

Same issue 👍🏻

(node:20352) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
C:\secret_path\node_modules\flowbite-datepicker\js\Datepicker.js:1
import {lastItemOf, stringToArray, isInRange} from './lib/utils.js';

@git-init-wesley
Copy link

Please make @type or resolve this !

@jcouser
Copy link

jcouser commented Mar 4, 2023

Any update on this? This is causing some build issues and would love to use the date picker.

@mwalden2004
Copy link

Really would like to see this fixed. Very annoying problem, and sad to see the Flowbite team isn't responding to this problem.

@af-lsh
Copy link

af-lsh commented Oct 2, 2023

Unfortunately afaik there are no typescript definitions. You could try to solve your problem by creating a type definition file next to your date picker component.

// picker.d.ts
declare module 'flowbite-datepicker/Datepicker';

This wouldn't bring you types but at least it makes the compiler happier

@mo9a7i
Copy link

mo9a7i commented Oct 22, 2023

@Freyia-C
Copy link

got same issue in my project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants