Skip to content

Commit 85e6e5e

Browse files
committed
fix: pwa plugin should be ignored when target is not app
close #1497
1 parent 7d06f09 commit 85e6e5e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/@vue/cli-plugin-pwa/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
module.exports = (api, options) => {
22
api.chainWebpack(webpackConfig => {
3+
const target = process.env.VUE_CLI_BUILD_TARGET
4+
if (target && target !== 'app') {
5+
return
6+
}
7+
38
const name = api.service.pkg.name
49
const userOptions = options.pwa || {}
510

packages/@vue/cli-service/lib/Service.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,9 @@ module.exports = class Service {
194194

195195
// check if the user has manually mutated output.publicPath
196196
const target = process.env.VUE_CLI_BUILD_TARGET
197-
const exceptionTargets = ['lib', 'wc', 'wc-async']
198197
if (
199198
!process.env.VUE_CLI_TEST &&
200-
!exceptionTargets.includes(target) &&
199+
(target && target !== 'app') &&
201200
config.output.publicPath !== this.projectOptions.baseUrl
202201
) {
203202
throw new Error(

0 commit comments

Comments
 (0)