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

How to specify SERVER_BUNDLE_ONLY in production? #1334

Closed
Overload119 opened this issue Oct 17, 2020 · 2 comments
Closed

How to specify SERVER_BUNDLE_ONLY in production? #1334

Overload119 opened this issue Oct 17, 2020 · 2 comments
Labels

Comments

@Overload119
Copy link

I'm able to get pre-rendering working fine locally but I have issues in production.

Here's the error I see.
https://gist.github.com/Overload119/908f96279a537d84a1da9fec5a877a83

I'm pretty sure it's because my server bundle is not being used (I'm using server-side rendering with HMR).

webpackConfig.js

if (process.env.WEBPACK_DEV_SERVER || process.env.CLIENT_BUNDLE_ONLY) {
    // eslint-disable-next-line no-console
    console.log('[React on Rails] Creating only the client bundles.');
    result = clientConfig();
  } else if (process.env.SERVER_BUNDLE_ONLY) {
    // eslint-disable-next-line no-console
    console.log('[React on Rails] Creating only the server bundle.');
    result = serverConfig();
  } else {
    // default is the standard client and server build
    // eslint-disable-next-line no-console
    console.log('[React on Rails] Creating both client and server bundles.');
    result = [clientConfig(), serverConfig()];
  }

How do I make sure pre-rendering on the server-side is using this process.env.SERVER_BUNDLE_ONLY flag?

@justin808
Copy link
Member

The process.env.SERVER_BUNDLE_ONLY is used only for building the server bundle when using the webpack-dev-server, so this is not relevant to your production setup.

Your gist error message does not show the source of the error.

@Overload119
Copy link
Author

Thanks! Yeah I misunderstood a ton of things here, but I eventually found out the issue was this one:
webpack/webpack#8677

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

No branches or pull requests

2 participants