Skip to content

Commit

Permalink
build: define DPLAYER_VERSION using webpack.DefinePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
micooz committed Jul 28, 2017
1 parent 5f9e1a3 commit 0a7ff40
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/DPlayer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
console.log('\n %c DPlayer 1.5.0 %c http://dplayer.js.org \n\n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');

import './DPlayer.scss';

import utils, {isMobile} from './utils';
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// eslint-disable-next-line
console.log(`\n %c DPlayer ${DPLAYER_VERSION} %c http://dplayer.js.org \n\n`, 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');

module.exports = require('./DPlayer');
5 changes: 4 additions & 1 deletion webpack/dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ module.exports = {
},

plugins: [
new webpack.NamedModulesPlugin()
new webpack.NamedModulesPlugin(),
new webpack.DefinePlugin({
DPLAYER_VERSION: `"${require('../package.json').version}"`
})
],

node: {
Expand Down
3 changes: 3 additions & 0 deletions webpack/prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ module.exports = {
},

plugins: [
new webpack.DefinePlugin({
DPLAYER_VERSION: `"${require('../package.json').version}"`
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
Expand Down

0 comments on commit 0a7ff40

Please sign in to comment.