Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/firestore/exp/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@firebase/firestore-exp",
"description": "A tree-shakeable version of the Firestore SDK",
"main": "../dist/exp/index.node.umd.js",
"main": "../dist/exp/index.node.cjs.js",
"main-esm": "../dist/exp/index.node.esm2017.js",
"module": "../dist/exp/index.browser.esm2017.js",
"browser": "../dist/exp/index.browser.esm2017.js",
"react-native": "../dist/exp/index.rn.esm2017.js",
"esm5": "../dist/exp/index.browser.esm5.js",
"typings": "../dist/exp/index.d.ts",
"private": true
}
3 changes: 2 additions & 1 deletion packages/firestore/lite/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@firebase/firestore-lite",
"description": "A lite version of the Firestore SDK",
"main": "../dist/lite/index.node.umd.js",
"main": "../dist/lite/index.node.cjs.js",
"main-esm": "../dist/lite/index.node.esm2017.js",
"module": "../dist/lite/index.browser.esm2017.js",
"browser": "../dist/lite/index.browser.esm2017.js",
"react-native": "../dist/lite/index.rn.esm2017.js",
"esm5": "../dist/lite/index.browser.esm5.js",
"typings": "../dist/lite/index.d.ts",
"private": true
}
21 changes: 18 additions & 3 deletions packages/firestore/rollup.config.exp.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ const allBuilds = [
},
onwarn: util.onwarn
},
// Node UMD build
// Node CJS build
{
input: path.resolve('./exp', pkg['main-esm']),
output: {
file: path.resolve('./exp', pkg.main),
format: 'umd',
name: 'firebase.firestore',
format: 'cjs',
sourcemap: true
},
plugins: util.es2017ToEs5Plugins(/* mangled= */ false),
Expand All @@ -126,6 +125,22 @@ const allBuilds = [
moduleSideEffects: false
}
},
// Convert es2017 build to ES5
{
input: path.resolve('./exp', pkg['browser']),
output: [
{
file: path.resolve('./exp', pkg['esm5']),
format: 'es',
sourcemap: true
}
],
plugins: util.es2017ToEs5Plugins(/* mangled= */ false),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this build used by? If this is a browser build, then we should turn on mangling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By people who need to support IE and don't want to compile library code.
The es2017 build which is the source is mangled, so we don't need to mangle the second time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you will get size savings if you turn on mangling here. It runs terser again. I am no longer sure what the exact numbers for the savings were, but all other builds follow this same pattern (mangle=true for both browser builds and off for Node). If you don't see any difference in size then you can merge as is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@Feiyang1 Feiyang1 May 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no mangle -> mangle
main: 855343 -> 749475
lite: 262207 -> 231834

They do get smaller.

external: util.resolveBrowserExterns,
treeshake: {
moduleSideEffects: false
}
},
// RN build
{
input: './exp/index.rn.ts',
Expand Down
21 changes: 18 additions & 3 deletions packages/firestore/rollup.config.lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ const allBuilds = [
},
onwarn: util.onwarn
},
// Node UMD build
// Node CJS build
{
input: path.resolve('./lite', pkg['main-esm']),
output: {
file: path.resolve('./lite', pkg.main),
format: 'umd',
name: 'firebase.firestore',
format: 'cjs',
sourcemap: true
},
plugins: [
Expand Down Expand Up @@ -139,6 +138,22 @@ const allBuilds = [
moduleSideEffects: false
}
},
// Convert es2017 build to ES5
{
input: path.resolve('./lite', pkg.browser),
output: [
{
file: path.resolve('./lite', pkg.esm5),
format: 'es',
sourcemap: true
}
],
plugins: util.es2017ToEs5Plugins(/* mangled= */ false),
external: util.resolveBrowserExterns,
treeshake: {
moduleSideEffects: false
}
},
// RN build
{
input: './lite/index.ts',
Expand Down