-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
webpack.config.js
53 lines (50 loc) · 1.65 KB
/
webpack.config.js
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
44
45
46
47
48
49
50
51
52
53
const path = require('path');
const { execSync } = require('child_process');
const { VueLoaderPlugin } = require('vue-loader');
const webpack = require('webpack');
const RIOT_WEB_VERSION = execSync('git describe --abbrev=0 --tags', { cwd: path.resolve(__dirname, './3rdparty/riot-web') }).toString();
const RIOT_WEB_HASH = execSync(`git rev-parse -- ${RIOT_WEB_VERSION}`, { cwd: path.resolve(__dirname, './3rdparty/riot-web') }).toString();
module.exports = {
entry: {
adminSettings: path.join(__dirname, 'src', 'adminSettings.js'),
main: path.join(__dirname, 'src', 'main.js'),
logout: path.join(__dirname, 'src', 'logout.js'),
},
output: {
path: path.join(__dirname, 'js'),
publicPath: '/js/',
},
devtool: 'source-map',
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
module: {
rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
],
},
plugins: [
new VueLoaderPlugin(),
new webpack.DefinePlugin({
RIOT_WEB_HASH: JSON.stringify(RIOT_WEB_HASH),
RIOT_WEB_VERSION: JSON.stringify(RIOT_WEB_VERSION),
}),
],
resolve: {
extensions: ['.js', '.vue'],
},
};