flowbite-datepicker icon indicating copy to clipboard operation
flowbite-datepicker copied to clipboard

SyntaxError: Cannot use import statement outside a module

Open roo12312 opened this issue 2 years ago • 10 comments

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

roo12312 avatar Dec 21 '22 09:12 roo12312

Same issue here

MEddarhri avatar Dec 23 '22 09:12 MEddarhri

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.

manufarez avatar Dec 29 '22 21:12 manufarez

Same issue here.

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

xiaohanyu avatar Jan 07 '23 10:01 xiaohanyu

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 avatar Feb 24 '23 14:02 git-init-wesley

Please make @type or resolve this !

git-init-wesley avatar Feb 27 '23 12:02 git-init-wesley

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

jcouser avatar Mar 04 '23 00:03 jcouser

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

mwalden2004 avatar Mar 15 '23 04:03 mwalden2004

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

af-lsh avatar Oct 02 '23 14:10 af-lsh

got same issue in my project

Freyia-C avatar Nov 14 '23 21:11 Freyia-C