vue-cli
vue-cli copied to clipboard
Does @vue/cli-service provide a way to call the JavaScript API to build?
Version
3.11.0
Reproduction link
Environment info
Does @vue/cli-service provide a way to call the JavaScript API to build?
Steps to reproduce
Does @vue/cli-service provide a way to call the JavaScript API to build?
What is expected?
provide a way to call the JavaScript API to build
What is actually happening?
There is no way to build with JavaScript API
Hi, why you need to call this in JavaScript api?
Can you use exec
or execSync
to build with build command?
Try to use like this:
const {execSync} = require("child_process")
execSync("npm run build")
Hi, why you need to call this in JavaScript api? Can you use
exec
orexecSync
to build with build command?Try to use like this:
const {execSync} = require("child_process") execSync("npm run build")
I need to flexibly perform packaging operations in the node environment
Hi, why you need to call this in JavaScript api? Can you use
exec
orexecSync
to build with build command? Try to use like this:const {execSync} = require("child_process") execSync("npm run build")
I need to flexibly perform packaging operations in the node environment
Then why you can't use execSync to do build operations? I think this method is available for you :)
If you really have some problems with this method, can you tell me more about your usage?
Hi, why you need to call this in JavaScript api? Can you use
exec
orexecSync
to build with build command? Try to use like this:const {execSync} = require("child_process") execSync("npm run build")
I need to flexibly perform packaging operations in the node environment
Then why you can't use execSync to do build operations? I think this method is available for you :)
If you really have some problems with this method, can you tell me more about your usage?
For example, I need to dynamically add or delete plugins
Hi, why you need to call this in JavaScript api? Can you use
exec
orexecSync
to build with build command? Try to use like this:const {execSync} = require("child_process") execSync("npm run build")
I need to flexibly perform packaging operations in the node environment
Then why you can't use execSync to do build operations? I think this method is available for you :) If you really have some problems with this method, can you tell me more about your usage?
For example, I need to dynamically add or delete plugins
Then just npm i name && npm run build
, there isn't any problem.
You can do anything you want with child_process