Skip to content

Commit 3545adf

Browse files
Better docs
1 parent 9fd0e0d commit 3545adf

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

packages/firestore/rollup.config.es.js

+24-19
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ import { resolveNodeExterns, resolveBrowserExterns } from './rollup.shared';
2626
import pkg from './package.json';
2727
import memoryPkg from './memory/package.json';
2828

29+
// This file defines the second rollup pipeline and transpiles the ES2017 SDK
30+
// into ES3 code. By splitting the build process into two independent build
31+
// pipelines, we take advantage of tree shaking in ES2017 builds even for
32+
// language levels that don't support tree shaking.
33+
2934
const browserPlugins = [
3035
typescriptPlugin({
3136
typescript,
@@ -45,6 +50,25 @@ const browserPlugins = [
4550
sourcemaps()
4651
];
4752

53+
const nodePlugins = [
54+
typescriptPlugin({
55+
typescript,
56+
compilerOptions: {
57+
allowJs: true,
58+
importHelpers: true
59+
},
60+
include: ['dist/*.js']
61+
}),
62+
terser({
63+
output: {
64+
comments: 'all',
65+
beautify: true
66+
},
67+
mangle: false
68+
}),
69+
sourcemaps()
70+
];
71+
4872
const browserBuilds = [
4973
{
5074
input: pkg.esm2017,
@@ -80,25 +104,6 @@ const browserBuilds = [
80104
}
81105
];
82106

83-
const nodePlugins = [
84-
typescriptPlugin({
85-
typescript,
86-
compilerOptions: {
87-
allowJs: true,
88-
importHelpers: true
89-
},
90-
include: ['dist/*.js']
91-
}),
92-
terser({
93-
output: {
94-
comments: 'all',
95-
beautify: true
96-
},
97-
mangle: false
98-
}),
99-
sourcemaps()
100-
];
101-
102107
const nodeBuilds = [
103108
{
104109
input: pkg.mainES2017,

packages/firestore/rollup.config.es2017.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
nodeDeps
3737
} from './rollup.shared';
3838

39-
// This Firestore Rollup configuration provides a number of different builds:
39+
// Firestore is released in a number of different build configurations:
4040
// - Browser builds that support persistence in ES5 CJS and ES5 ESM formats and
4141
// ES2017 in ESM format.
4242
// - In-memory Browser builds that support persistence in ES5 CJS and ES5 ESM
@@ -48,6 +48,10 @@ import {
4848
// The in-memory builds are roughly 130 KB smaller, but throw an exception
4949
// for calls to `enablePersistence()` or `clearPersistence()`.
5050
//
51+
// We use two different rollup pipelines to take advantage of tree shaking in
52+
// the ES2017 builds. The build pipeline in this file produces ES2017 builds
53+
// that are consumed by `rollup.config.es.js`.
54+
//
5155
// All browser builds rely on Terser's property name mangling to reduce code
5256
// size.
5357
//

0 commit comments

Comments
 (0)