-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
82 lines (79 loc) · 2.54 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const path = require('path');
const webpack = require("webpack");
const conf = require("./config.json");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
let config = {
context: path.resolve(__dirname),
devtool: 'eval-source-map',
entry: path.resolve(__dirname, "src/main.ts"),
output: {
path: path.resolve(__dirname, "dist"),
filename: 'main.js',
},
resolve: {
alias: {
"src": path.resolve(__dirname, "src"),
},
extensions: [ '.ts', '.js' ]
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
loader: 'ts-loader'
},
{
test: /\.html$/,
include: /src\/components/,
loader: 'vue-template-loader',
options: {
scoped: false,
},
},
{
test: /\.scss$/,
loader: 'sass-loader',
options: {
sourceMap: true
},
},
{
enforce: 'post',
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
sourceMap: true
}
}
]
}
]
},
plugins: [
new webpack.DefinePlugin({
'API_URL': JSON.stringify(conf.API_URL),
'DEVELOPMENT': JSON.stringify(process.env.NODE_ENV == 'development'),
'PRODUCTION': JSON.stringify(process.env.NODE_ENV == 'production'),
'SOURCE_URL': JSON.stringify("https://github.com/lsteehouwer/cmod"),
'BUG_URL': JSON.stringify("https://github.com/lsteehouwer/cmod/issues"),
'INSTITUTION': JSON.stringify("Utrecht University"),
'SHOW_SUCCESS_MESSAGE': JSON.stringify(conf.SHOW_SUCCESS_MESSAGE),
'SHOW_QUESTIONNAIRE_MESSAGE': JSON.stringify(conf.SHOW_QUESTIONNAIRE_MESSAGE),
'QUESTIONNAIRE_URL': JSON.stringify(conf.QUESTIONNAIRE_URL)
}),
new HtmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html",
inject: "head",
}),
new MiniCssExtractPlugin({
filename: "style.css"
}),
]
}
module.exports = config;