This message was deleted.
# ask-questions
w
This message was deleted.
f
Hi Kei
❤️ 1
how are you trying to install it?
a
that's my question
I already installed
@growthbook/growthbook
module
but can't import the plugin modules
f
did you update to 1.4.1?
a
yes
I tried to import the plugins like this:
f
ya, that looks right
you using npm or yarn?
a
but getting this error:
Copy code
Cannot find module '@growthbook/growthbook/plugins' or its corresponding type declarations.
I'm using npm
f
Copy code
npm list --depth=0 |grep growthbook
what does that return?
huh
checking with the team, one sec
a
Thanks @fresh-football-47124
f
while I'm waiting - I have a work around if you need
they might not respond until tomorrow as its late here
oh?
a
Actually, my goal is to setup tracking on GA4 and GTM using those modules
f
okay
a
@fresh-football-47124 what module should be installed exactly?
for that
f
I wonder if the node modules have the wrong version cached - can you see the plugin folder under @growthbook/growthbook?
a
let me check
f
huh
a
am I using the old version?
f
that looks right
f
A few questions that help debug 1. Are you using Typescript? If so, what is your
target
and
moduleResolution
set to in your tsconfig? 2. What bundler are you using? Webpack? Vite? Something else? 3. Are you using a framework like Next.js, Angular, Astro, etc. ? If so, what version?
a
Hi @future-teacher-7046 Thanks for asking these questions. 1. Yes, target: "es5", we don't have
moduleResolution
config. 2. webpack 3. Next.js, 14.2.5
s
@agreeable-train-79582 did you get to the bottom of this issue? @future-teacher-7046 did you get any extra hints to solve this? In the same boat right now as well. TS: yes Target: es2020 ModuleResolution: node Bundler: Webpac React 18 SPA
f
I think I missed the answer to those questions earlier, so sorry for not responding then! I think this has to do with
moduleResolution
. The
node
setting is old and doesn't support newer style imports.
node16
and
nodenext
are both newer values for this setting that should work. Updating your moduleResolution might cause other issues in other parts of your code base. As a quick workaround, can you try importing from here instead?
@growthbook/growthbook/dist/plugins/
s
Adding
dist
into the path doesn't help. Adjusting the
moduleResolution
isn't working yet either, but I might have to tinker more with the project setup (yeah, its a dated project)
a
Hi @square-eve-67382 I'm not sure if you are still having the issue. I could address the issue by declaring the module in
global.d.ts
Copy code
declare module '@growthbook/growthbook/plugins';
s
That doesn't seem to work for our older codebase either 😞 We ended up with just using this in our eslintrc file:
Copy code
"import/no-unresolved": ["error", { "ignore": ["^@growthbook/growthbook/plugins$"] }]
Not great, but unblocks us in the short term.
180 Views