-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
svelte.config.js
37 lines (35 loc) · 1.13 KB
/
svelte.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
const sveltePreprocess = require('svelte-preprocess');
const { existsSync } = require('fs');
const { resolve } = require('path');
let customPreprocess;
const customPath = resolve('./svelte.config.custom.js');
if (existsSync(customPath)) {
customPreprocess = require(customPath);
}
// this can be called either through svelte-loader where we want either __ANDROID__ or __IOS__ to be defined but not both
// or through svelte-check where we want both so everything is checked
const webpack_env = process.env['NATIVESCRIPT_WEBPACK_ENV']
? JSON.parse(process.env['NATIVESCRIPT_WEBPACK_ENV'])
: {
android: true,
ios: true
};
module.exports = {
compilerOptions: {
namespace: 'foreign'
},
preprocess: [
sveltePreprocess({
replace: [
[/__ANDROID__/g, !!webpack_env.android],
[/__IOS__/g, !!webpack_env.ios]
].concat(customPreprocess?.replace || []),
typescript: {
compilerOptions: {
target: 'es2020'
}
}
})
// svelteNativePreprocessor()
]
};