diff --git a/package-lock.json b/package-lock.json index e9187020b5e54a27407c9e87d2f62c0ad3f7a963..2b7e3b2fe1abfc13716f7c1ec5b3b26cc1863acd 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index 60e024ac99b17ded932b0182b3de9d68ce7afc7f..8b1207c1e82f94a25f73c47d0138355ce5f36edb 100644 --- a/package.json +++ b/package.json @@ -123,8 +123,7 @@ "ts-jest": "^27.0.5", "typescript": "^4.5.2", "webpack": "^5.64.1", - "webpack-cli": "^4.8.0", - "webpack-version-file-plugin": "^0.4.0" + "webpack-cli": "^4.9.1" }, "dependencies": { "@types/argparse": "^2.0.10", diff --git a/webpack.config.common.js b/webpack.config.common.js index d403e707fbf7905510aba8ee0b38f277d86da2de..491eb8d551226831574049bcd850af99c1b939f7 100644 --- a/webpack.config.common.js +++ b/webpack.config.common.js @@ -1,8 +1,17 @@ const path = require('path'); +const fs = require('fs'); const webpack = require('webpack'); const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const VersionFile = require('webpack-version-file-plugin'); +const VERSION = require('./package.json').version; + +class VersionFilePlugin { + apply() { + fs.writeFileSync( + path.resolve(__dirname, 'lib/mol-plugin/version.js'), + `export var PLUGIN_VERSION = '${VERSION}';\nexport var PLUGIN_VERSION_DATE = new Date(typeof __MOLSTAR_DEBUG_TIMESTAMP__ !== 'undefined' ? __MOLSTAR_DEBUG_TIMESTAMP__ : ${new Date().valueOf()});`); + } +} const sharedConfig = { module: { @@ -36,12 +45,7 @@ const sharedConfig = { '__MOLSTAR_DEBUG_TIMESTAMP__': webpack.DefinePlugin.runtimeValue(() => `${new Date().valueOf()}`, true) }), new MiniCssExtractPlugin({ filename: 'molstar.css' }), - new VersionFile({ - extras: { timestamp: `${new Date().valueOf()}` }, - packageFile: path.resolve(__dirname, 'package.json'), - templateString: `export var PLUGIN_VERSION = '<%= package.version %>';\nexport var PLUGIN_VERSION_DATE = new Date(typeof __MOLSTAR_DEBUG_TIMESTAMP__ !== 'undefined' ? __MOLSTAR_DEBUG_TIMESTAMP__ : <%= extras.timestamp %>);`, - outputFile: path.resolve(__dirname, 'lib/mol-plugin/version.js') - }) + new VersionFilePlugin(), ], resolve: { modules: [