-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathtsup.config.ts
More file actions
63 lines (59 loc) · 1.68 KB
/
tsup.config.ts
File metadata and controls
63 lines (59 loc) · 1.68 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
52
53
54
55
56
57
58
59
60
61
62
63
import { join } from 'path';
import { defineConfig } from 'tsup';
import baseConfig from '../../tsup.base.config';
// Redirect import paths for "microsoft-cognitiveservices-speech-sdk(...)"
// to point to es2015 distribution for all importing modules
const resolveCognitiveServicesToES2015 = {
name: 'microsoft-cognitiveservices-speech-sdk',
setup(build) {
build.onResolve({ filter: /microsoft-cognitiveservices-speech-sdk.+/u }, args => ({
path: join(process.cwd(), 'node_modules', args.path.replace('distrib/lib', 'distrib/es2015') + '.js')
}));
}
};
const config: typeof baseConfig = {
...baseConfig,
entry: {
'botframework-directlinespeech-sdk': './src/index.mjs'
},
env: {
...baseConfig.env,
// Followings are required by microsoft-cognitiveservices-speech-sdk:
NODE_TLS_REJECT_UNAUTHORIZED: '',
SPEECH_CONDUCT_OCSP_CHECK: '',
SPEECH_OCSP_CACHE_ROOT: ''
},
esbuildPlugins: [resolveCognitiveServicesToES2015],
// We need to internalize event-target-shim because it appear as transient packages with a different version.
noExternal: ['event-target-shim']
};
export default defineConfig([
{
...config,
format: 'esm'
},
{
...config,
format: 'cjs',
target: [...config.target, 'es2019']
},
{
...config,
dts: false,
entry: {
[process.env.NODE_ENV === 'production' ? 'directlinespeech.production.min' : 'directlinespeech.development']:
'./src/index.mjs'
},
env: {
...config.env,
module_format: 'global'
},
esbuildPlugins: [],
format: 'iife',
outExtension() {
return { js: '.js' };
},
platform: 'browser',
target: [...config.target, 'es2019']
}
]);