next-translate-plugin icon indicating copy to clipboard operation
next-translate-plugin copied to clipboard

Configuration option to customize the pkgDir

Open myabeaver opened this issue 2 years ago • 4 comments

What version of this package are you using?

What problem do you want to solve?

We use Nx to run our monorepo. Nx has made an adjustment in version 16.3.2 that causes the current working directory to dynamically adjust depending on the project. We are therefore forced to adjust thepkgDir (used to create the basePath) to '.' respectively the current working directory (process.cwd()).

What do you think is the correct solution to this problem?

Add a configuration option to NextConfig, such as nextTranslate. such as:

interface NextConfigWithNextTranslate extends NextConfig {
    nextTranslate?: {
        pkgDir?: string | (() => string);
    }
}

Are you willing to submit a pull request to implement this change?

Yes

myabeaver avatar Jun 26 '23 06:06 myabeaver

We added a env variable for this https://github.com/aralroca/next-translate#13-how-to-use-next-translate-in-a-mono-repo

It should work

aralroca avatar Jun 26 '23 17:06 aralroca

@aralroca This is not suitable for our use case since it does not fallback to process.cwd() (require('pkg-dir')) gets resolved.

myabeaver avatar Jun 28 '23 05:06 myabeaver

@myasteiner feel free to PR 👌

aralroca avatar Jun 28 '23 08:06 aralroca

@aralroca I've created two PR's:

  • https://github.com/aralroca/next-translate-plugin/pull/55
  • https://github.com/aralroca/next-translate/pull/1096

@aralroca Thank you for your time

myabeaver avatar Jun 29 '23 12:06 myabeaver