Skip to content
Discussion options

You must be logged in to vote

This one is a bit tricky to understand, but basically the Webpack DefinePlugin is used to replace NEXT_PUBLIC_ prefixes env vars with their value during build time, into the source code. This depends on the exact process.env.NEXT_PUBLIC_ declaration. It is a bit of magic, coming from the ability to statically analyze this declaration.

As you can image, this is rather sensitive, and something like global.process.env.NEXT_PUBLIC_ falls out and is considered to be dynamic access.

See this documentation from that DefinePlugin plugin:

Something like this they document over at that plugin:

new webpack.DefinePlugin({
  'typeof window': JSON.stringify(

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mikhail-fedosenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants