Next.js Discord

Discord Forum

Read flag file from .next static output

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hey,
i'm creating a flag file called slsq-config.json with a npm plugin for NextJS. The file is stored at top level of my Next app and I copy it into the static folder with webpack like
webpack(config: any, options: WebpackConfigContext) {
      if (!options.isServer) {
        config.plugins.push(
          new CopyPlugin({
            patterns: [
              {
                from: FLAG_FILE,
                to: 'static'
              },
            ],
          })
        );
      }


I see the file now in the output, however, I'm not sure how I can read from it now during runtime as it's not in my top level anymore and in the production build output (see attached image)

Who can give me a hint please?

0 Replies