viclafouch / mui-color-input

📌 A color input designed for MUI (Material ui) V6 built with TinyColor
https://viclafouch.github.io/mui-color-input/
60 stars 20 forks source link

SyntaxError: Cannot use import statement outside a module, NEXTJS 14.2.3 #37

Closed darkdiesel closed 2 months ago

darkdiesel commented 2 months ago

Using sample example from your docs and get error .



SyntaxError: Cannot use import statement outside a module
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
<unknown>
file:/var/www/admin-panel.loc/node_modules/mui-color-input/dist/mui-color-input.es.js (1)
Next.js
mui-color-input
file:/var/www/admin-panel.loc/.next/server/pages/settings.js (1798:18)
Next.js
eval
/src/pages/settings/index.tsx
./src/pages/settings/index.tsx
file:/var/www/admin-panel.loc/.next/server/pages/settings.js (1180:1)
Next.js```
sankaran85 commented 2 months ago

facing same issue in nextjs .. import { MuiColorInput } from 'mui-color-input'

Kaaaaii commented 2 months ago

same issue here

viclafouch commented 2 months ago

Hello !

Try this :

/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['mui-color-input'],
}

module.exports = nextConfig