forked from tify-iiif-viewer/tify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
68 lines (63 loc) · 1.86 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
const fs = require('fs');
// eslint-disable-next-line import/no-extraneous-dependencies
const BannerPlugin = require('webpack/lib/BannerPlugin');
const globImporter = require('node-sass-glob-importer');
const VueAutomaticImportPlugin = require('vue-automatic-import-loader/lib/plugin');
const env = require('./package.json');
process.env.VUE_APP_VERSION = env.version;
process.env.VUE_APP_LICENSE = env.license;
process.env.VUE_APP_BUGS_URL = env.bugs.url;
process.env.VUE_APP_CONTRIBUTORS_URL = 'https://github.com/tify-iiif-viewer/tify/blob/main/CONTRIBUTORS.md';
process.env.VUE_APP_DOCS_URL = `${env.repository.url}/blob/v${env.version}/doc`;
process.env.VUE_APP_DOCS_LANGUAGES = [...new Set(fs.readdirSync('./doc').map((file) => file.split('.')[1]))];
process.env.VUE_APP_REPOSITORY_URL = env.repository.url;
module.exports = {
publicPath: '',
chainWebpack: (config) => {
config.module.rule('eslint')
.use('eslint-loader')
.options({ fix: true });
},
configureWebpack: {
optimization: {
splitChunks: false,
},
output: {
filename: 'tify.js',
},
plugins: [
// Prepend copyright notice to each compiled file
new BannerPlugin(
`TIFY v${env.version}`
+ `\n(c) 2017-${new Date().getFullYear()}`
+ ' Göttingen State and University Library (https://www.sub.uni-goettingen.de/en/)'
+ `\n${env.license}`
+ `\n${env.homepage}`,
),
new VueAutomaticImportPlugin({
match(originalTag, { kebabTag, camelTag }) {
if (kebabTag.startsWith('icon-')) {
return [camelTag, `import ${camelTag} from '@/components/icons/${camelTag}'`];
}
return null;
},
}),
],
},
css: {
extract: {
filename: 'tify.css',
},
loaderOptions: {
scss: {
sassOptions: {
importer: globImporter(),
},
},
},
},
productionSourceMap: false,
devServer: {
port: process.env.NODE_ENV === 'test' ? 8888 : 8080,
},
};