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

Issue with with 2.0.3 #31

Closed dmitriy-baltak closed 6 months ago

dmitriy-baltak commented 6 months ago

Version 2.0.3 has issue on build:

/node_modules/mui-color-input/dist/mui-color-input.es.js:1 import { jsx as c, jsxs as ct, Fragment as At } from "react/jsx-runtime"; ^^^^^^

SyntaxError: Cannot use import statement outside a module at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1274:20) at Module._compile (node:internal/modules/cjs/loader:1320:27) at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) at Module.load (node:internal/modules/cjs/loader:1197:32) at Module._load (node:internal/modules/cjs/loader:1013:12) at Module.require (node:internal/modules/cjs/loader:1225:19) at mod.require (/Users/d.baltak/Projects/agnoplay-website/node_modules/next/dist/server/require-hook.js:65:28) at require (node:internal/modules/helpers:177:18)

Version 2.0.2 and lower works fine

viclafouch commented 6 months ago

Hummm are u sure about version 2.0.2 ? Do you have a link for repro ?

viclafouch commented 6 months ago

https://github.com/viclafouch/mui-color-input/commit/89e2c58af6d67910d6d63059da0bdb8a54945a80 Only thing I changed in 2.0.3

dmitriy-baltak commented 6 months ago

Well seems like nothing basically changed by I'm having the issue nonetheless. Both on local env and acc env 2.0.3 doesn't work. I first tried to roll back to 2.0.1 that was working and then to 2.0.2 that worked as well. No repro unfurtunatly since that happens during the build

AkitoItashi commented 6 months ago

I have the same problem and rolling back to version 2.0.2 helped. The error is not occuring anymore.

But I saw one little thing...

I use next.js and tried to import the module dynamically, but that got me an error at version 2.0.2... The error was "Module not found: Default condition should be last one".

Maybe this could help you?

viclafouch commented 6 months ago

I have the same problem and rolling back to version 2.0.2 helped. The error is not occuring anymore.

But I saw one little thing...

I use next.js and tried to import the module dynamically, but that got me an error at version 2.0.2... The error was "Module not found: Default condition should be last one".

Maybe this could help you?

This error is fixed in 2.0.3 🙂

viclafouch commented 6 months ago

If you are using next.js, maybe try this:

const nextConfig = {
  transpilePackages: ['mui-color-input'],
}

module.exports = nextConfig
joeplaa commented 6 months ago

If you are using next.js, maybe try this:

const nextConfig = {
  transpilePackages: ['mui-color-input'],
}

module.exports = nextConfig

I can confirm @viclafouch' solution works. Thanks!

AkitoItashi commented 6 months ago

Ah thank you very much @viclafouch for the solution!!! ^-^

kutsen-rom commented 6 months ago

Maybe that will help someone, in my case I had to add 'mui-color-input' to withTM

 const withTM = require('next-transpile-modules')([
   ...,
    'mui-color-input',
  ]);