vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.75k stars 6.32k forks source link

config path cli option #3152

Open Globegitter opened 5 years ago

Globegitter commented 5 years ago

What problem does this feature solve?

In some way this relates to #3150, but even more generically, sometimes the vue-cli-service cli is executed in a different working directory than the config is located, so it would be greate if it was possible to pass the custom location of the config in. This would unblock our usage with bazel.

What does the proposed API look like?

I would say vue-cli-service -c path/vue.config.js is quite common for such a flag

LinusBorg commented 5 years ago

I'm not sure I understand this feature request, especially in terms how how it's different to #3150 and what the usecase is. Also, what's the error/issue happening right now?

jkzing commented 5 years ago

@Globegitter , FYI you can do it by:

VUE_CLI_CONTEXT=/path/to/your/dir /path/to/your/dir/node_modules/.bin/vue-cli-service build

Emm, It's not documented though.

DoHe commented 5 years ago

I worked together with @Globegitter on integrating vue-cli properly with bazel, so maybe I can shed some light. One of the core assumptions of bazel is that all commands run from the root of your monorepository and that all paths are relative to that. So let's assume we have a project in /subdir/projectx, but bazel runs it from /, so we need a way to pick up the config at /subdir/projectx/vue.config.js. Thanks @jkzing your hint really helped us! There is still one issue though that makes things more complicated for us then they would need to be, which is that VUE_CLI_CONTEXT has to be an absolute path. As bazel does a lot of process isolation (also using different directories for everything), it's not trivial to build absolute paths before runtime. I tried to make it accept relative paths here but have to admit that I wasn't really able to make this work. Hope that clarifies this issue a bit.

dubov94 commented 4 years ago

@Globegitter @DoHe Looks like you were on the right track, and thanks @jkzing for the tip indeed! Are you still planning to push your PR forward?

FWIW I cooked up my own small wrapper for now.