-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaunty.config.js
61 lines (54 loc) · 1.56 KB
/
aunty.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
const path = require('path');
const fs = require('fs');
const includedDependencies = [/layercake/, /carbon-/];
const getLoaderDefinition = (config, testSourceMatch, loaderMatch) =>
config.module.rules
.find(({ test }) => test?.source.indexOf(testSourceMatch) > -1)
.use.find(({ loader }) => loader.indexOf(loaderMatch || testSourceMatch) > -1);
module.exports = {
type: 'svelte',
build: {
includedDependencies,
entry: [
"index",
"builder",
],
},
webpack: config => {
// De-dupe svelte
config.resolve.alias = {
...(config.resolve.alias || {}),
svelte: path.resolve('node_modules', 'svelte')
};
// Disable dart-sass warnings
getLoaderDefinition(config, 'scss', 'sass').options = { sassOptions: { quietDeps: true } };
// console.log(config);
// Disable svelte warnings when compiling dependencies
// getLoaderDefinition(config, 'svelte').options.onwarn = (warning, handler) => {
// for (const pattern of includedDependencies) {
// if (pattern.test(warning.filename)) {
// return;
// }
// }
//
// handler(warning);
// };
return config;
},
deploy: [
{
to: '/www/res/sites/news-projects/<name>/<id>'
},
config => {
fs.writeFileSync(
path.join(__dirname, 'redirect', 'index.js'),
`window.location = String(window.location).replace('/latest/', '/${config.id}/')`
);
return {
...config,
from: 'redirect',
to: '/www/res/sites/news-projects/<name>/latest'
};
}
]
};