-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtsup.config.ts
More file actions
51 lines (47 loc) · 1.19 KB
/
Copy pathtsup.config.ts
File metadata and controls
51 lines (47 loc) · 1.19 KB
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
import { defineConfig } from 'tsup';
import { utimes } from 'fs/promises';
import { version } from './package.json';
const PROD = process.env.ENV === 'PROD';
const BANNER = [
'/**',
'* SPX ~ Single Page XHR | https://spx.js.org',
'*',
'* @license CC BY-NC-ND 4.0',
`* @version ${version}`,
'* @copyright 2024 Nikolas Savvidis',
'*/'
];
export default defineConfig({
entry: [
'./src/index.ts'
],
format: [ 'esm' ],
clean: false,
outDir: './',
minify: PROD,
outExtension: () => ({ js: '.js' }),
platform: 'browser',
keepNames: false, // Possible breaks may need to use true in v1
splitting: false,
target: 'es2017',
globalName: 'spx',
treeshake: 'smallest',
banner: () => ({ js: BANNER.join('\n') }),
esbuildOptions (options) {
if (PROD) {
options.mangleQuoted = false;
options.mangleProps = /^\$[a-z]/;
}
},
async onSuccess () {
if (!PROD) {
const time = new Date();
await Promise.all([
utimes('./docs/src/app/bundle.ts', time, time),
utimes('./docs/src/app/iframe.ts', time, time),
utimes('./test/asset/suite.ts', time, time),
utimes('./test/views/base.liquid', time, time)
]);
}
}
});