Skip to content

Commit

Permalink
fix: pwa plugin should be ignored when target is not app
Browse files Browse the repository at this point in the history
close #1497
  • Loading branch information
yyx990803 committed Jun 7, 2018
1 parent 7d06f09 commit 85e6e5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/@vue/cli-plugin-pwa/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module.exports = (api, options) => {
api.chainWebpack(webpackConfig => {
const target = process.env.VUE_CLI_BUILD_TARGET
if (target && target !== 'app') {
return
}

const name = api.service.pkg.name
const userOptions = options.pwa || {}

Expand Down
3 changes: 1 addition & 2 deletions packages/@vue/cli-service/lib/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,9 @@ module.exports = class Service {

// check if the user has manually mutated output.publicPath
const target = process.env.VUE_CLI_BUILD_TARGET
const exceptionTargets = ['lib', 'wc', 'wc-async']
if (
!process.env.VUE_CLI_TEST &&
!exceptionTargets.includes(target) &&
(target && target !== 'app') &&
config.output.publicPath !== this.projectOptions.baseUrl
) {
throw new Error(
Expand Down

0 comments on commit 85e6e5e

Please sign in to comment.