plugin to extend options vue.config.js
See original GitHub issueWhat problem does this feature solve?
we have a plugin. This plugin will generate some data into vue.config.js when it is invoked. we can’t put this data into package.json, because it depend on some modules. for example:
const path = require('path')
module.exports = {
css: {
extract: true,
loaderOptions: {
stylus: {
'resolve url': true,
import: [path.resolve(__dirname, './src/theme')]
}
}
}
}
if we use api.render to generate vue.config.js, it can work. But if another plugin generate vue.config.js, the old vue.config.js will be overwrited.
What does the proposed API look like?
maybe like api.injectImports and api.injectRootOptions
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Plugin Development Guide - Vue CLI
extending package.json - a useful option when your plugin adds some dependencies to the project and you need to add them to package...
Read more >Configuration Reference | Vue CLI
vue.config.js is an optional config file that will be automatically loaded by @vue/cli-service if it's present in your project root (next to ...
Read more >Working with Webpack | Vue CLI
The easiest way to tweak the webpack config is providing an object to the configureWebpack option in vue.config.js :.
Read more >Plugins and Presets - Vue CLI
A Vue CLI preset is a JSON object that contains pre-defined options and plugins for creating a new project so that the user...
Read more >Is it possible to modify and/or extend the options ... - Vue Forum
In vue.config.js I tried approaches like chainWebpack: config => { config .plugin('html') .tap(args => { console.log(args) // args[0] ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Akryum If it’s not recommended that we edit
vue.config.js
via a plugin initializing, what would be the recommended method to change theoutputDir
when a plugin initializes? Is there one, or would the user have to manually editvue.config.js
after the fact?Specifically looking at making the
outputDir
dynamic based on the outcome of a conditional statement. Use case is regarding using the CLI 3 with NativeScript & Webpack and having theoutputDir
be determined by whether it is IOS or Android.I have the rest of the templating worked out except for how to change the
outputDir
since we’re only supposed to change this invue.config.js
👍