mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-21 11:58:36 -05:00
fix(ui): wrong context for webpack config, closes 1611
This commit is contained in:
@@ -8,7 +8,7 @@ const {
|
||||
getPluginLink
|
||||
} = require('@vue/cli-shared-utils')
|
||||
const getPackageVersion = require('@vue/cli/lib/util/getPackageVersion')
|
||||
const { resolveModule, loadModule } = require('@vue/cli/lib/util/module')
|
||||
const { resolveModule, loadModule, clearModule } = require('@vue/cli/lib/util/module')
|
||||
const {
|
||||
progress: installProgress,
|
||||
installPackage,
|
||||
@@ -340,6 +340,9 @@ function runInvoke (id, context) {
|
||||
status: 'plugin-invoke',
|
||||
args: [id]
|
||||
})
|
||||
|
||||
clearModule('@vue/cli-service/webpack.config.js', cwd.get())
|
||||
|
||||
currentPluginId = id
|
||||
// Allow plugins that don't have a generator
|
||||
if (resolveModule(`${id}/generator`, cwd.get())) {
|
||||
|
||||
@@ -7,6 +7,7 @@ const { getFeatures } = require('@vue/cli/lib/util/features')
|
||||
const { defaults } = require('@vue/cli/lib/options')
|
||||
const { toShortPluginId } = require('@vue/cli-shared-utils')
|
||||
const { progress: installProgress } = require('@vue/cli/lib/util/installDeps')
|
||||
const { clearModule } = require('@vue/cli/lib/util/module')
|
||||
// Connectors
|
||||
const progress = require('./progress')
|
||||
const cwd = require('./cwd')
|
||||
@@ -250,6 +251,9 @@ async function create (input, context) {
|
||||
cwd.set(targetDir, context)
|
||||
creator.context = targetDir
|
||||
|
||||
process.env.VUE_CLI_CONTEXT = targetDir
|
||||
clearModule('@vue/cli-service/webpack.config.js', targetDir)
|
||||
|
||||
const inCurrent = input.folder === '.'
|
||||
const name = inCurrent ? path.relative('../', process.cwd()) : input.folder
|
||||
creator.name = name
|
||||
|
||||
@@ -52,6 +52,13 @@ exports.loadModule = function (request, context, force = false) {
|
||||
}
|
||||
}
|
||||
|
||||
exports.clearModule = function (request, context) {
|
||||
const resolvedPath = exports.resolveModule(request, context)
|
||||
if (resolvedPath) {
|
||||
clearRequireCache(resolvedPath)
|
||||
}
|
||||
}
|
||||
|
||||
function clearRequireCache (id, map = new Map()) {
|
||||
const module = require.cache[id]
|
||||
if (module) {
|
||||
|
||||
Reference in New Issue
Block a user