Skip to content

Commit 7804b6c

Browse files
posvayyx990803
authored andcommitted
Add version variable (vuejs#507)
1 parent 9b6e452 commit 7804b6c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

build/rollup.config.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
const buble = require('rollup-plugin-buble')
2+
const replace = require('rollup-plugin-replace')
23
const version = process.env.VERSION || require('../package.json').version
34

45
module.exports = {
56
entry: 'src/index.js',
67
dest: 'dist/vuex.js',
78
format: 'umd',
89
moduleName: 'Vuex',
9-
plugins: [buble()],
10+
plugins: [
11+
replace({ __VERSION__: version }),
12+
buble()
13+
],
1014
banner:
1115
`/**
1216
* vuex v${version}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"phantomjs-prebuilt": "^2.1.7",
5858
"rollup": "^0.34.13",
5959
"rollup-plugin-buble": "^0.14.0",
60+
"rollup-plugin-replace": "^1.1.1",
6061
"rollup-watch": "^2.5.0",
6162
"selenium-server": "^2.53.1",
6263
"todomvc-app-css": "^2.0.3",

src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ if (typeof window !== 'undefined' && window.Vue) {
414414
export default {
415415
Store,
416416
install,
417+
version: '__VERSION__',
417418
mapState,
418419
mapMutations,
419420
mapGetters,

0 commit comments

Comments
 (0)