Răsfoiți Sursa

build: define DPLAYER_VERSION using webpack.DefinePlugin

Micooz 8 ani în urmă
părinte
comite
0a7ff40311
4 a modificat fișierele cu 10 adăugiri și 3 ștergeri
  1. 0 2
      src/DPlayer.js
  2. 3 0
      src/index.js
  3. 4 1
      webpack/dev.config.js
  4. 3 0
      webpack/prod.config.js

+ 0 - 2
src/DPlayer.js

@@ -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';

+ 3 - 0
src/index.js

@@ -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');

+ 4 - 1
webpack/dev.config.js

@@ -91,7 +91,10 @@ module.exports = {
     },
 
     plugins: [
-        new webpack.NamedModulesPlugin()
+        new webpack.NamedModulesPlugin(),
+        new webpack.DefinePlugin({
+            DPLAYER_VERSION: `"${require('../package.json').version}"`
+        })
     ],
 
     node: {

+ 3 - 0
webpack/prod.config.js

@@ -85,6 +85,9 @@ module.exports = {
     },
 
     plugins: [
+        new webpack.DefinePlugin({
+            DPLAYER_VERSION: `"${require('../package.json').version}"`
+        }),
         new webpack.optimize.UglifyJsPlugin({
             compress: {
                 warnings: false