-
Notifications
You must be signed in to change notification settings - Fork 125
/
rollup.config.cjs
66 lines (60 loc) · 1.67 KB
/
rollup.config.cjs
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
import dts from 'rollup-plugin-dts';
import {getConfig, getPlugins} from '../../../config/rollup/rollup-utils';
import * as pkg from './package.json';
const mainSrcInput = 'src/index.ts';
const clientSrcInput = 'src/graphql-client/index.ts';
const packageName = pkg.name.substring(1);
export const bannerConfig = {
banner: `/*! ${packageName}@${pkg.version} -- Copyright (c) 2023-present, Shopify Inc. -- license (MIT): https://github.com/Shopify/shopify-app-js/blob/main/LICENSE.md */`,
};
const config = [
{
input: clientSrcInput,
plugins: getPlugins({
outDir: './dist/umd',
minify: true,
tsconfig: './tsconfig.umd.json',
replacements: {ROLLUP_REPLACE_CLIENT_VERSION: pkg.version},
bundleDependencies: true,
}),
output: [
{
file: './dist/umd/graphql-client.min.js',
format: 'umd',
sourcemap: true,
name: 'ShopifyGraphQLClient',
...bannerConfig,
},
],
},
{
input: clientSrcInput,
plugins: getPlugins({
outDir: './dist/umd',
tsconfig: './tsconfig.umd.json',
replacements: {ROLLUP_REPLACE_CLIENT_VERSION: pkg.version},
bundleDependencies: true,
}),
output: [
{
file: './dist/umd/graphql-client.js',
format: 'umd',
sourcemap: true,
name: 'ShopifyGraphQLClient',
...bannerConfig,
},
],
},
...getConfig({
pkg,
input: mainSrcInput,
flatOutput: true,
replacements: {ROLLUP_REPLACE_CLIENT_VERSION: pkg.version},
}),
{
input: './dist/ts/index.d.ts',
output: [{file: 'dist/graphql-client.d.ts', format: 'es'}],
plugins: [dts.default()],
},
];
export default config;