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

Feat: Add config option to run the built in server in cluster mode and to ignore some files of being added with resource hints #59

Merged
merged 12 commits into from
Oct 20, 2019

Conversation

p1n5u
Copy link
Contributor

@p1n5u p1n5u commented Feb 8, 2019

First, thank you for this awesome vue-cli plugin!

As I wanted to run the built-in server in cluster mode I've added the config option to be able to accomplish this.
As the dev server does not need clustered mode (and also does not like it 🙈) I've adapted the server.js file to set up the cluster as soon as the config option clustered is set to true and the NODE_ENV equals production. The cluster will create one worker per CPU core and also listens to the workers exit events to be able to fork a new one if one crashes. This prevents the server to lose all of its workers in case of failure. The workers will start the server as it was before.
If one of both rules does not apply, the server will launch as it was before my changes.

EDIT 1:
I've also adapted the check isProd in lib/webpack.js. Before my change, the check was based on the VUE_CLI_MODE. But as many developers have multiple custom Vue modes (in my case production, staging, and development) that all build and serve the app in the same way but with different Vue specific environment variables, I've changed the check to use the NODE_ENV. This allows the developers to have custom Vue modes and to control the build/serve process with the NODE_ENV.

EDIT 2:
As I needed the possibility to exclude some static assets of being added to the manifests and being prefetched/preloaded I've added 2 options to specify files from being ignored accordingly to https://ssr.vuejs.org/guide/build-config.html#client-config

@p1n5u p1n5u changed the title Add config option to run the built in server in cluster mode in production Add config option to run the built in server in cluster mode Feb 8, 2019
@p1n5u p1n5u changed the title Add config option to run the built in server in cluster mode Feat: Add config option to run the built in server in cluster mode and to ignore some files of being added with resource hints Mar 18, 2019
@Akryum Akryum merged commit b7c9394 into Akryum:master Oct 20, 2019
@Akryum
Copy link
Owner

Akryum commented Oct 20, 2019

👍

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

Successfully merging this pull request may close these issues.

2 participants