summaryrefslogtreecommitdiff
path: root/ofborg/ofborg-viewer/webpack.config.js
blob: f7cfd86bbfecd6115b6395e9964ef278b537fcdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const {get_version, get_revision} = require("./webpack/revision");

module.exports = {
	entry: "./src/index.js",
	output: {
		filename: "bundle.js",
		path: path.resolve(__dirname, "dist")
	},
	module: {
		loaders: [
			{
				test: /.js$/,
				// ES2015 to JS, without some features:
				// → https://buble.surge.sh/guide/
				loaders: "buble-loader",
				include: path.join(__dirname, "src"),
				query: {
					objectAssign: "Object.assign"
				}
			},
			{
				test: /\.less$/,
				use: [
					{loader: "raw-loader"},
					{loader: "less-loader"},
				]
			},
		]
	},
	plugins: [
		new HtmlWebpackPlugin({
			hash: true,
			template: "src/app.html",
		}),
		new webpack.DefinePlugin({
			"GIT_REVISION": JSON.stringify(get_revision()),
			"VERSION": JSON.stringify(get_version()),
		}),
	]
};