PiwikPRO / next-piwik-pro

Library for implementing Piwik PRO in Next.js web applications
MIT License
1 stars 4 forks source link

Issue importing piwik pro [ERR_UNSUPPORTED_DIR_IMPORT] #30

Open y-az opened 1 month ago

y-az commented 1 month ago

Hi there,

I'm on next 13.1.5, and on next build I'm getting an error about directory import. I'm using Next pages if that's important.

"@piwikpro/next-piwik-pro": "^3.1.0",
"next": "13.1.5",

The error is ..Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/myProject/node_modules/@piwikpro/next-piwik-pro/dist/core' is not supported resolving ES modules imported from /myProject/node_modules/@piwikpro/next-piwik-pro/dist/index.js

I tried transpiling the package transpilePackages: ["@piwikpro/next-piwik-pro"] in next.config.js but that yields another error:

..ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and 'myProject/node_modules/@piwikpro/react-piwik-pro/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

Any ideas on how to resolve?

auto200 commented 1 month ago

Hey @y-az, we are aware of the issues with the pages router setup. Fix for it is on our roadmap and you can expect it in upcoming days/weeks

y-az commented 1 month ago

Hey @y-az, we are aware of the issues with the pages router setup. Fix for it is on our roadmap and you can expect it in upcoming days/weeks

Thanks @auto200, I'll await that fix then 👍

josselinlbe commented 3 weeks ago

Any idea when it's fixed? We want to run ads with Piwik :)

y-az commented 1 week ago

@lysy-vlc do you have an expectation for when the pages router fix can be merged? Thank you for your work