mocoapp-browser-extension/webpack.base.config.js
Manuel Bouza 72626a6c42
qw/timer (#23)
* Rename logo and add 32x32 version

* Set timer icon if a timer is running

* Do not query activities on initialization

* Show timer in bubble if timed activity exists

* Pass timed activity to App

* Code cleanup

* Show timer view and stop timer

* Make hours optional

* Use booked seconds instead of hours

* Add type submit to form button

* Define colors as sass variables⎄

* Style timer view

* Show start timer submit label

* Update view layouts and content

* Update version and changelog

* Dyanically set iframe height

* Reduce h1 font size

* Add svg webpack loader

* Parse empty string (TimeInputParser)

* Forward ref in Popup component

* Start time on current day only, format buttons

* Improve styling

* Set standard height as iframe default height, validate form

* Upgrade packages to supress react warning

* Show activity form in popup after timer was stoped

* Use stop-watch icon in timer view

* Fix empty description

* Close TimerView if timer stopped for current service

* Style timerview

* Improve timer view styling

* qw/setting-time-tracking-hh-mm (#24)

* Format duration depending on settingTimeTrackingHHMM

* Fix formatDuation without second argument

* Fix time format after updating bubble

* Add tests for formatDuration
2019-10-10 14:57:01 +02:00

112 lines
2.9 KiB
JavaScript

require("dotenv").config()
const path = require("path")
const webpack = require("webpack")
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const ZipPlugin = require("zip-webpack-plugin")
module.exports = env => {
const config = {
entry: {
background: "./src/js/background.js",
content: "./src/js/content.js",
popup: "./src/js/popup.js",
options: "./src/js/options.js",
},
output: {
path: path.join(__dirname, `build/${env.browser}`),
filename: `[name].${process.env.npm_package_version}.js`,
},
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
"css-loader",
{
loader: "sass-loader",
options: {
sassOptions: {
includePaths: [path.join(__dirname, "src/css")],
},
},
},
],
exclude: /node_modules/,
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.(jpg|png)$/,
loader: "file-loader",
options: {
name: "[path][name].[ext]",
},
exclude: /node_modules/,
},
{
test: /\.svg$/,
loader: "svg-inline-loader",
},
],
},
plugins: [
new CleanWebpackPlugin({
cleanAfterEveryBuildPatterns: ["!manifest.json"],
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(env.NODE_ENV),
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css",
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "background.html"),
filename: "background.html",
chunks: ["background"],
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "popup.html"),
filename: "popup.html",
chunks: ["popup"],
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "options.html"),
filename: "options.html",
chunks: ["options"],
}),
],
resolve: {
modules: [path.join(__dirname, "src/js"), "node_modules"],
alias: {
images: path.join(__dirname, "src/images"),
},
},
mode: env.NODE_ENV || "development",
devtool: "cheap-module-source-map",
}
if (env.NODE_ENV === "production") {
config.devtool = "none"
config.plugins.push(
new ZipPlugin({
filename: `moco-bx-${env.browser}-v${process.env.npm_package_version}.zip`,
exclude: [/\.map$/],
}),
)
}
return config
}