mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-18 08:47:11 -05:00
support inspect paths
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
module.exports = (api, options) => {
|
||||
api.registerCommand('inspect', {
|
||||
description: 'inspect internal webpack config',
|
||||
usage: 'vue-cli-service inspect [options] [...keys]',
|
||||
usage: 'vue-cli-service inspect [options] [...paths]',
|
||||
options: {
|
||||
'--mode': 'specify env mode (default: development)'
|
||||
}
|
||||
}, args => {
|
||||
api.setMode(args.mode || 'development')
|
||||
|
||||
const get = require('get-value')
|
||||
const stringify = require('javascript-stringify')
|
||||
const config = api.resolveWebpackConfig()
|
||||
const keys = args._
|
||||
const paths = args._
|
||||
|
||||
let res
|
||||
if (keys.length) {
|
||||
if (paths.length > 1) {
|
||||
res = {}
|
||||
keys.forEach(key => {
|
||||
res[key] = config[key]
|
||||
paths.forEach(path => {
|
||||
res[path] = get(config, path)
|
||||
})
|
||||
} else if (paths.length === 1) {
|
||||
res = get(config, paths[0])
|
||||
} else {
|
||||
res = config
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"file-loader": "^1.1.6",
|
||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||
"get-value": "^2.0.6",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"husky": "^0.14.3",
|
||||
"javascript-stringify": "^1.6.0",
|
||||
|
||||
Reference in New Issue
Block a user