Closed ciruz closed 1 year ago
I set up Piwik PRO with next.js, according to the following official instructions - https://developers.piwik.pro/en/latest/data_collection/web/frameworks/Piwik_PRO_Library_for_NextJS.html
Piwik PRO
next.js
But immediately when I start the dev server, I get this import error:
/Users/ciruz/dev/node/next-piwik/node_modules/@piwikpro/next-piwik-pro/index.js:1 import { PiwikProProvider, usePiwikPro } from './core'; ^^^^^^ SyntaxError: Cannot use import statement outside a module
/Users/ciruz/dev/node/next-piwik/node_modules/@piwikpro/next-piwik-pro/index.js:1 import { PiwikProProvider, usePiwikPro } from './core'; ^^^^^^
SyntaxError: Cannot use import statement outside a module
I also created a new and blank next.js installation without any modifications, still get the same error.
Empty next example repo: https://github.com/ciruz/next-piwik-error
Any ideas? Thanks
In the readme.md is a useful information about import errors with ESM libaries. This solved my issue. I added this information to the docs too.
I set up
Piwik PRO
withnext.js
, according to the following official instructions - https://developers.piwik.pro/en/latest/data_collection/web/frameworks/Piwik_PRO_Library_for_NextJS.htmlBut immediately when I start the dev server, I get this import error:
I also created a new and blank next.js installation without any modifications, still get the same error.
Empty next example repo: https://github.com/ciruz/next-piwik-error
Any ideas? Thanks