This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
76 lines (68 loc) · 2.25 KB
/
vue.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
const path = require('path');
const coffeescript = require('coffeescript');
const fs = require('fs');
process.env.VUE_APP_APP_VERSION = require('./package.json').version;
process.env.VUE_APP_THEME_PRIMARY_COLOR = '#FFFFFF';
const is_production = process.env.NODE_ENV === 'production';
module.exports = {
productionSourceMap: true,
// css: {
// TODO: multiple ssr vue instantiation bug, see uvue#59. only dev though (?) reactivate?
// sourceMap: true,
// },
chainWebpack: (config) => {
config.resolve.extensions
.add('.coffee')
config.module
.rule('coffee')
.after('vue')
.test(/\.coffee$/)
// alternatively, maybe use coffee-loader transpile options? TODO. ...follow https://github.com/cxspxr/vue-cli-plugin-coffee/issues/4
// FIXME: This babel transpilation is NOT applied in app-legacy.js of uvue's `ssr:build --modern` build!
// --modern cannot be used because of this right now. How to solve this?
.use('coffee/babel')
.loader('babel-loader')
.end()
.use('coffee/loader')
.loader('coffee-loader')
.end()
.use('coffee/custom-loader')
.loader(resolve_custom_loader('coffee-loader'))
.end()
.end()
.rule('slm')
.after('coffee')
.test(/\.slm$/)
.use('slm/loader')
.loader('slm-loader')
.end()
.use('slm/custom-loader')
.loader(resolve_custom_loader('slm-loader'))
.end()
.end()
},
pwa: {
workboxOptions: {
skipWaiting: true,
directoryIndex: 'null' // TODO test if this actually did anything
},
name: 'Produpedia.org',
themeColor: process.env.VUE_APP_THEME_PRIMARY_COLOR,
msTileColor: '#FFFFFF',
manifestOptions: {
// icons: []
},
iconPaths: {
favicon32: 'img/icons/logo.svg',
favicon16: 'img/icons/logo.svg',
appleTouchIcon: false,
maskIcon: false,
msTileImage: false
}
},
}
function resolve_custom_loader(loader_name) {
const loader_file = path.join(__dirname, 'custom-loaders', loader_name);
fs.writeFileSync(`${loader_file}.js`, coffeescript.compile(fs.readFileSync(`${loader_file}.coffee`, 'utf-8'))); // todo I dont know how to tell webpack to accept a coffee loaderscript file directly please fix me. edit: -> https://webpack.js.org/configuration/configuration-languages/
return loader_file;
};