Skip to content

Commit d910859

Browse files
committed
refactor($ga): using define
1 parent a2f34f5 commit d910859

File tree

1 file changed

+3
-10
lines changed
  • packages/@vuepress/plugin-google-analytics

1 file changed

+3
-10
lines changed

packages/@vuepress/plugin-google-analytics/index.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
const path = require('path')
22

33
module.exports = (options = {}, context) => ({
4-
ready () {
4+
define () {
55
const { siteConfig = {}} = context
66
const ga = options.ga || siteConfig.ga
7-
context.GA_ID = ga ? JSON.stringify(ga) : false
8-
},
9-
10-
chainWebpack (config) {
11-
config.plugin('injections').tap(([options]) => [
12-
Object.assign(options, {
13-
GA_ID: context.GA_ID
14-
})
15-
])
7+
const GA_ID = ga || false
8+
return { GA_ID }
169
},
1710

1811
enhanceAppFiles: [

0 commit comments

Comments
 (0)