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

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

Open
shendiid opened this issue Nov 17, 2023 · 5 comments
Open

Comments

@shendiid
Copy link

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

@xiaodong2008
Copy link

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

@shendiid
Copy link
Author

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

@xiaodong2008
Copy link

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?

@shendiid
Copy link
Author

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

@xiaodong2008
Copy link

xiaodong2008 commented Nov 20, 2023

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

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

No branches or pull requests

2 participants