getWpHostname()
Type error causes npx depcheck
to fail
#1411
-
I am getting the following error when trying to run
It's pointing to the function's use of Replication: // next.config.js
const { withFaust, getWpHostname } = require( '@faustwp/core' ); // eslint-disable-line @typescript-eslint/no-var-requires
/**
* @type {import('next').NextConfig}
*/
module.exports = withFaust( {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
swcMinify: true,
trailingSlash: true,
reactStrictMode: true,
compress: true,
productionBrowserSourceMaps: true,
experimental: {
runtime: 'nodejs',
},
pageExtensions: [ 'ts', 'tsx', 'js', 'jsx' ],
images: {
domains: [
getWpHostname(),
process.env.NEXT_PUBLIC_WORDPRESS_URL,
],
minimumCacheTTL: 31536000,
},
sassOptions: {
includePaths: [ 'node_modules', './src' ],
},
async redirects() {
return require( './redirects.json' );
},
},
); # /project-root
npx depcheck |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I had a quick look at this. The It tries to load the Then the What you want to do is install depcheck globally
Then export the
I'm moving this to a Q/A discussion threat since it's not an issue. |
Beta Was this translation helpful? Give feedback.
I had a quick look at this.
The
depcheck
tries to load thewebpack
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
Then export the
NEXT_PUBLIC_WORDPRESS_URL=http://mysite.local/
before you run depcheck.