Issue importing piwik pro [ERR_UNSUPPORTED_DIR_IMPORT]
Closed this issue ยท 6 comments
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?
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
Any idea when it's fixed? We want to run ads with Piwik :)
@lysy-vlc do you have an expectation for when the pages router fix can be merged? Thank you for your work
Hey @josselinlbe, @y-az Sorry for the delay, with 3.1.1 release we added instruction for pages router