Skip to content

revert: revert node-externals disabling in dev mode #5452

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

Merged
merged 1 commit into from
Apr 3, 2019

Conversation

clarkdo
Copy link
Member

@clarkdo clarkdo commented Apr 3, 2019

This pr is reverting #5414 since including all node_modules will cause problems.

So for fixing dev mode memory leak issue, we suggest user using build.standalone: true.

standalone mode will include all node_modules into server bundle file and avoid shared Vue module in Node.js main process which leads to memory leak in dev mode.

But one thing need to be notified is: If all node_modules all bundled into server.js by webpack, the modules which are using Node.js globals and modules like __dirname won't work as be resolved successfully by webpack, so those modules need to be declared in webpack externals.

For example: firebase and its dependency grpc are using __direname, so the config would be like:

// nuxt.config.js
export default {
  build: {
    standalone: true,
    extend(config, { isDev, isServer }) {
      if (isDev && isServer) {
        config.externals = [
          'grpc',
          '@firebase/app',
          '@firebase/auth',
          '@firebase/firestore',
          '@firebase/storage'
        ]
      }
    }
  }
}

@clarkdo clarkdo requested a review from a team April 3, 2019 09:38
@pi0 pi0 changed the title fix: revert node-externals disabling in dev mode revert: revert node-externals disabling in dev mode Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants