Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: 'window' defines, removal of fast-refresh event listener in prod #50

Open
nathanjhood opened this issue Oct 9, 2024 · 1 comment

Comments

@nathanjhood
Copy link
Owner

Updates to common and build options default objects:

{
  define: {
      "process.env": JSON.stringify(
        getClientEnvironment(proc).stringified["process.env"]
      ),
      "window": JSON.stringify({
        IS_PRODUCTION: proc.env['NODE_ENV'] === 'production' ? true : false,
        location: {
          hostname: '???',  //proc.env['WDS_SOCKET_HOST'] 
         port: '???',              //proc.env['WDS_SOCKET_PORT'] 
        }
      })
    }
}
@nathanjhood
Copy link
Owner Author

Working locally, testing later:

const buildOptions: ESBuild.BuildOptions = {
    // defaults
    ...defaultBuildOptions,
    // // args
    // ...options,
    // required
    banner: {
      // js: `new EventSource('/esbuild').addEventListener('change', () => location.reload(),{once:true});`,
      js:
        proc.env['FAST_REFRESH'] === 'false'
          ? ''
          : `new EventSource('${wdsSocketPath}').addEventListener('change', () => ${wdsSocketHost}.reload(),{once:true});`,
    },
    format: 'esm',
    sourcemap: proc.env['GENERATE_SOURCEMAP'] === 'true' || false,
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant