Use process.env.NEXT_PUBLIC_* in 3rd party NPM package #17262
Unanswered
eric-burel
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am developing a
next-apollo
package on top ofnext-with-apollo
, with a slightly simplified interface.Previously, the code of the package was living directly into a Next app code (see withApollo code).
It now lives into a Lerna repository (see the new withApollo version).
It relies on a
process.env.NEXT_PUBLIC_GRAPHQL_URI
to get the default URL from config.However, now that the package lives into its own repo, it doesn't benefit from Next build time.
I've tried to setup
next-transpile-modules
without success, see my next config.What is the expected behaviour regarding
process.env
in 3rd party repo, and more broadly building modules that target Next? Is what I am trying to do actually doable?I'd like to find solutions that requires minimal modification in the end-application, though I can accept adding something like next-transpile-modules.
Related:
Possible lead:
Built code is looking like this: "process.env.NEXT_PUBLIC_GRAPHQL_URI",e.env.NEXT_PUBLIC_GRAPHQL_URI)". Since Babel is looking for
process.env
that may break it. I may need to publish my Next package as a raw package and let Next do all the building instead.Beta Was this translation helpful? Give feedback.
All reactions