vue-cli icon indicating copy to clipboard operation
vue-cli copied to clipboard

Does @vue/cli-service provide a way to call the JavaScript API to build?

Open shendiid opened this issue 1 year ago • 5 comments

Version

3.11.0

Reproduction link

cli.vuejs.org

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

shendiid avatar Nov 17 '23 08:11 shendiid

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")

xiaodong2008 avatar Nov 20 '23 07:11 xiaodong2008

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")

I need to flexibly perform packaging operations in the node environment

shendiid avatar Nov 20 '23 11:11 shendiid

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")

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?

xiaodong2008 avatar Nov 20 '23 11:11 xiaodong2008

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")

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

shendiid avatar Nov 20 '23 12:11 shendiid

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")

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

xiaodong2008 avatar Nov 20 '23 12:11 xiaodong2008