Skip to content

feat(build/serve): export build/serve command and allow them to take config argument (chainable webpack config) #1585

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

Closed
wants to merge 7 commits into from

Conversation

nklayman
Copy link

@nklayman nklayman commented Jun 15, 2018

Solves #1551 by changing the build command to export itself. It can then be imported and ran with a custom config that will be used instead of api.resolveChainableWebpackConfig(). This allows plugins to modify the webpack config only if their build command is run, not for normal builds.

Edit: Now does same process for the serve command.

@nklayman nklayman changed the title feat(build): export build command and allow it to take config argument feat(build/serve): export build/serve command and allow them to take config argument (chainable webpack config) Jun 18, 2018
@nklayman nklayman mentioned this pull request Jun 18, 2018
@nklayman
Copy link
Author

Make sure to hide whitespace changes in the diff viewer. Indentation is updated, so it looks like there are more changes.

@nklayman
Copy link
Author

nklayman commented Jun 26, 2018

For some reason that I can not find, HMR is broken in these cases:

  • serve function is imported and called from a plugin
  • serve function is called using service.run('serve') (assuming service = new Service(api.resolve('.')))

Yet it still works when:

  • serve function is imported and called from a plugin, but only if calling package is linked with yarn link
  • called with api.service.run('serve') from a plugin
  • called with vue-cli-service serve

@nklayman
Copy link
Author

Another method of implementing this feature would be to allow service.run() to take a 4th argument. That argument would be an array of arguments that will be passed to the command the service calls. This would likely fix the HMR issue (and other related ones) and make it easier to add this feature to other plugins. I can create a PR for this method if it is preferred.

@Akryum
Copy link
Member

Akryum commented Jul 11, 2018

Another method of implementing this feature would be to allow service.run() to take a 4th argument.

Worth a try.

@nklayman
Copy link
Author

@Akryum I created a branch with service.run taking a 4th argument: https://github.com/nklayman/vue-cli/tree/service-run-4th-arg

@nklayman
Copy link
Author

If that works I can create a PR for that instead.

@nklayman
Copy link
Author

Closing as I found an alternative and lack of interest.

@nklayman nklayman closed this Aug 19, 2018
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