question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

plugin to extend options vue.config.js

See original GitHub issue

What 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:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jawa-the-huttcommented, Oct 31, 2018

@Akryum If it’s not recommended that we edit vue.config.js via a plugin initializing, what would be the recommended method to change the outputDir when a plugin initializes? Is there one, or would the user have to manually edit vue.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 the outputDir 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 in vue.config.js

0reactions
Akryumcommented, Aug 7, 2018

👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found