-
Notifications
You must be signed in to change notification settings - Fork 55
/
rollup.config.typescript.js
42 lines (40 loc) · 1.26 KB
/
rollup.config.typescript.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
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import commonjs from '@rollup/plugin-commonjs';
/**
* This Rollup config generates a JS module version of typescript from its
* CommonJS version.
*
* It's generated separately from the main Rollup config because it is an input
* to bundles generated there. We could also run this commonjs transform in the
* main Rollup config, but having a genuine module in the sources makes a few
* things easier:
*
* - We can import it into tests without also having to configure the commonjs
* transform there. @web/test-runner does support running the commonjs Rollup
* plugin, but for some reason it was still erroring.
*
* - The development loop generating the worker bundle is slightly faster,
* because we don't need to run the commonjs transform every time we build the
* worker.
*
* - We use module imports in the worker, for a faster development mode that
* doesn't bundle. Having only module sources makes this easier too.
*/
export default [
{
input: 'node_modules/typescript/lib/typescript.js',
output: {
file: 'internal/typescript.js',
format: 'esm',
},
plugins: [
commonjs({
ignore: (id) => true,
}),
],
},
];