fibo / trunx

Super Saiyan React components, son of awesome Bulma
MIT License
64 stars 14 forks source link

ReferenceError: exports is not defined in ES module scope #36

Closed davetapley closed 1 year ago

davetapley commented 2 years ago

Follow up to #35:

I was hoping to use Trunx in a a Next.js app. I can npm i trunx, but npm run dev gives:

error - ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/home/runner/next-trunx/nextjs-blog/node_modules/trunx/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

It's my first time using Next.js so possible I'm missing something there, but I figure it would be good if Trunx could 'just work' or have some docs to explain what to do.

Repro here: https://replit.com/@davetapley/next-trunx

Any ideas? 🤔

fibo commented 2 years ago

need to try yet trunx on next.js

fibo commented 1 year ago

hi @davetapley

created a next branch with a Next.js app using trunx

my plan it is to migrate trunx website to Next.js, it will take some time but in the meanwhile we should get a trunx version that works with Next

sorry for the delay, I was focused on another open source project I am working on (dflow)

fibo commented 1 year ago

@davetapley I started using trunx in a side project of mine (currently I am spending a lot of time on this side project, it is a crypto trading platform https://www.ggbot2.com/): so I expect to improve a lot trunx in the near future.

Luckily this side project is using Next.js and I was able to import trunx v0.42.3.

If you have time upgrade to that version, in case something is broken please let me know.

We are currently (me and @shrutivtu ) working on next branch, in case you want to do a PR (thank again for you contributions in the past) please start from that branch.

davetapley commented 1 year ago

@fibo great! I actually pivoted to use https://github.com/couds/react-bulma-components/, but since upgrading to Next.js canary I'm running in to trouble with that now and I'm not sure it's maintained, so I'm back here 😊

I see next branch has gone, so I presume you finished work?

Unfortunately with next 13.2.5-canary.24 I'm getting:

./node_modules/trunx/dist/components/index.js
The requested module './NavbarFixed.js' contains conflicting star exports for the names '$$typeof', '__esModule' with the previous requested module './Modal.js'

Not sure if that's something you've run in to?

fibo commented 1 year ago

Hi @davetapley

yes it is almost done, we are creating the trunx website with latest Next.js

I will look into this issue, thanks for reporting it.

Yes I created NavbarFixed as an alternative to Navbar but did not used it yet, it should be some imprt to fix.

fibo commented 1 year ago

Hi @davetapley

please update to trunx version 0.45.0.

Had to remove "use client" from trunx package, it looks like a bug in webpack since latest Next.js 13.3.

You can find NavbarFixed here, I had to remove it from trunx components and keep it as an example; it is used by trunx website Nav component here.