Skip to content
Snippets Groups Projects
Commit 674baa53 authored by Alexander Rose's avatar Alexander Rose
Browse files

localize plugin timestamp in browser, use webpack.DefinePlugin, enable in watch mode

parent 88c3516f
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -104,7 +104,6 @@
"raw-loader": "^1.0.0",
"resolve-url-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"string-replace-loader": "^2.1.1",
"style-loader": "^0.23.1",
"ts-jest": "^23.10.5",
"tslint": "^5.12.1",
......
......@@ -182,7 +182,7 @@ export class PluginContext {
this.lociLabels = new LociLabelManager(this);
// TODO: find a better solution for this.
setTimeout(() => this.log.message(`Mol* Plugin ${PLUGIN_VERSION} [${PLUGIN_VERSION_DATE}]`), 500);
setTimeout(() => this.log.message(`Mol* Plugin ${PLUGIN_VERSION} [${PLUGIN_VERSION_DATE.toLocaleString()}]`), 500);
}
// settings = ;
......
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
export const PLUGIN_VERSION = '0.5.0';
export const PLUGIN_VERSION_DATE = '$PLUGIN_VERSION_DATE$';
\ No newline at end of file
/** unix time stamp, to be filled in at bundle build time */
declare const __PLUGIN_VERSION_TIMESTAMP__: number
export const PLUGIN_VERSION_TIMESTAMP = __PLUGIN_VERSION_TIMESTAMP__;
export const PLUGIN_VERSION_DATE = new Date(PLUGIN_VERSION_TIMESTAMP);
\ No newline at end of file
const path = require('path');
const webpack = require('webpack');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// const CircularDependencyPlugin = require('circular-dependency-plugin');
......@@ -28,15 +29,7 @@ const sharedConfig = {
{
test: /\.(s*)css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'resolve-url-loader', 'sass-loader']
},
{
test: /version\.js$/,
loader: 'string-replace-loader',
options: {
search: '$PLUGIN_VERSION_DATE$',
replace: function (date) { return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate() } (new Date()),
}
}
}
]
},
plugins: [
......@@ -54,6 +47,9 @@ const sharedConfig = {
'./build/src/**/*.html'
],
}),
new webpack.DefinePlugin({
__PLUGIN_VERSION_TIMESTAMP__: webpack.DefinePlugin.runtimeValue(() => `${new Date().valueOf()}`, true),
}),
new MiniCssExtractPlugin({ filename: 'app.css' })
],
resolve: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment