Skip to content

Commit

Permalink
fix: build web modern error
Browse files Browse the repository at this point in the history
  • Loading branch information
mater1996 committed Mar 23, 2022
1 parent 7f93cde commit e8141d5
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions packages/vue-cli-plugin-mpx-web/commands/buildWeb.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
module.exports = function (api, options) {
const { build } = api.service.commands

async function legacyBuild(args, ...p) {
process.env.VUE_CLI_MODERN_BUILD = false
process.env.VUE_CLI_MODERN_MODE = true
await build.fn(
{
...args,
module: false,
moduleBuild: false,
keepAlive: true
},
...p
)
}

async function moduleBuild(args, ...p) {
process.env.VUE_CLI_MODERN_BUILD = true
process.env.VUE_CLI_MODERN_MODE = true
await build.fn(
{
...args,
module: true,
moduleBuild: true,
clean: false
},
...p
)
}

api.registerCommand('build:web', async function (args, ...p) {
if (!args.module) {
return build.fn(args, ...p)
if (args.module === undefined) {
await legacyBuild({ ...args }, ...p)
await moduleBuild({ ...args }, ...p)
} else {
args.module = false
await build.fn(args, ...p)
process.env.VUE_CLI_MODERN_BUILD = true
process.env.VUE_CLI_MODERN_MODE = true
await build.fn(args, ...p)
return build.fn(args, ...p)
}
})
}

0 comments on commit e8141d5

Please sign in to comment.