Skip to content

getWpHostname() Type error causes npx depcheck to fail #1411

Answered by theodesp
justlevine asked this question in Q&A
Discussion options

You must be logged in to vote

I had a quick look at this.

The depcheck tries to load the webpack config in this line:

https://github.com/depcheck/depcheck/blob/da616e724a5a33703cbaa17965e0ad90595198d2/src/special/webpack.js#L166

It tries to load the next.config.js config in your project folder.

Then the getWpHostname() is called however this does not load the env files from .env so it fails.

What you want to do is install depcheck globally

npm install -g depcheck 

Then export the NEXT_PUBLIC_WORDPRESS_URL=http://mysite.local/ before you run depcheck.

export NEXT_PUBLIC_WORDPRESS_URL=http://mysite.local/

❯ npx depcheck
Missing dependencies
* breakpoints: ./styles/global.scss
* css-variables: ./styles/global.scss
* ba…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@justlevine
Comment options

Answer selected by theodesp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1410 on May 04, 2023 10:21.