|
1 | 1 | /**
|
2 | 2 | * @license
|
3 |
| - * Copyright 2018 Google Inc. |
| 3 | + * Copyright 2018 Google LLC |
4 | 4 | *
|
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License");
|
6 | 6 | * you may not use this file except in compliance with the License.
|
@@ -105,6 +105,13 @@ const es5BuildPlugins = [
|
105 | 105 | transformers: appendPrivatePrefixTransformers,
|
106 | 106 | cacheRoot: `./.cache/es5.mangled/`
|
107 | 107 | }),
|
| 108 | + { |
| 109 | + transform(code) { |
| 110 | + // Allow Rollup to drop unused classes. |
| 111 | + // See https://github.com/rollup/rollup/issues/2807 |
| 112 | + return code.replace(/\/\*\* @class \*\//g, "\/*@__PURE__*\/"); |
| 113 | + } |
| 114 | + }, |
108 | 115 | json(),
|
109 | 116 | terser(manglePrivatePropertiesOptions)
|
110 | 117 | ];
|
@@ -152,7 +159,7 @@ const browserBuilds = [
|
152 | 159 | format: 'es',
|
153 | 160 | sourcemap: true
|
154 | 161 | },
|
155 |
| - plugins: es5BuildPlugins, |
| 162 | + plugins: es2017BuildPlugins, |
156 | 163 | external: resolveBrowserExterns
|
157 | 164 | },
|
158 | 165 | // ES2017 ESM build (memory-only)
|
@@ -198,6 +205,13 @@ const nodeBuildPlugins = [
|
198 | 205 | typescript,
|
199 | 206 | cacheRoot: `./.cache/node/`
|
200 | 207 | }),
|
| 208 | + { |
| 209 | + transform(code) { |
| 210 | + // Allow Rollup to drop unused classes. |
| 211 | + // See https://github.com/rollup/rollup/issues/2807 |
| 212 | + return code.replace(/\/\*\* @class \*\//g, "\/*@__PURE__*\/"); |
| 213 | + } |
| 214 | + }, |
201 | 215 | json(),
|
202 | 216 | // Needed as we also use the *.proto files
|
203 | 217 | copy({
|
|
0 commit comments