mirror of
https://github.com/KevinMidboe/vue-chartjs.git
synced 2025-10-29 09:50:21 +00:00
Refactor: Don't include package.json into dist files
Instead of including package.json file into the build files. Use webpacks DefinePlugin to define a global lib version.
This commit is contained in:
@@ -15,5 +15,8 @@ module.exports = {
|
||||
'arrow-parens': 0,
|
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
|
||||
},
|
||||
"globals": {
|
||||
"LIB_VERSION": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
'use strict'
|
||||
const webpack = require('webpack')
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const vueLoaderConfig = require('./vue-loader.conf')
|
||||
const npmCfg = require('../package.json')
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir)
|
||||
@@ -72,5 +74,10 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
LIB_VERSION: JSON.stringify(npmCfg.version)
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import mixins from './mixins/index.js'
|
||||
import npmCfg from '../package.json'
|
||||
|
||||
import {
|
||||
Bar,
|
||||
HorizontalBar,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from './BaseCharts'
|
||||
|
||||
const VueCharts = {
|
||||
version: npmCfg.version,
|
||||
version: LIB_VERSION,
|
||||
Bar,
|
||||
HorizontalBar,
|
||||
Doughnut,
|
||||
|
||||
Reference in New Issue
Block a user