Skip to content

Tree-Shake ES5 classes #2829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions packages/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"devDependencies": {
"protobufjs": "6.8.9",
"rollup": "2.0.6",
"rollup-plugin-babel": "4.4.0",
"rollup-plugin-copy-assets": "1.1.0",
"rollup-plugin-json": "4.0.0",
"rollup-plugin-node-resolve": "5.2.0",
Expand Down
23 changes: 17 additions & 6 deletions packages/firestore/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2018 Google Inc.
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,6 +24,7 @@ import copy from 'rollup-plugin-copy-assets';
import sourcemaps from 'rollup-plugin-sourcemaps';
import typescript from 'typescript';
import { terser } from 'rollup-plugin-terser';
import babel from 'rollup-plugin-babel';

import pkg from './package.json';
import memoryPkg from './memory/package.json';
Expand Down Expand Up @@ -101,12 +102,17 @@ export function resolveMemoryExterns(deps, externsId, referencedBy) {

const es5BuildPlugins = [
typescriptPlugin({
typescript,
typescript: {
compilerOptions: {
target: 'es2017'
}
},
transformers: appendPrivatePrefixTransformers,
cacheRoot: `./.cache/es5.mangled/`
}),
json(),
terser(manglePrivatePropertiesOptions)
terser(manglePrivatePropertiesOptions),
babel()
];

const es2017BuildPlugins = [
Expand Down Expand Up @@ -152,7 +158,7 @@ const browserBuilds = [
format: 'es',
sourcemap: true
},
plugins: es5BuildPlugins,
plugins: es2017BuildPlugins,
external: resolveBrowserExterns
},
// ES2017 ESM build (memory-only)
Expand Down Expand Up @@ -195,7 +201,11 @@ const browserBuilds = [

const nodeBuildPlugins = [
typescriptPlugin({
typescript,
typescript: {
compilerOptions: {
target: 'es2017'
}
},
cacheRoot: `./.cache/node/`
}),
json(),
Expand All @@ -205,7 +215,8 @@ const nodeBuildPlugins = [
}),
replace({
'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('src/protos')
})
}),
babel()
];

const nodeBuilds = [
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
dependencies:
"@babel/types" "^7.8.3"

"@babel/helper-module-imports@^7.8.3":
"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.8.3":
version "7.8.3"
resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz#7fe39589b39c016331b6b8c3f441e8f0b1419498"
integrity sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==
Expand Down Expand Up @@ -12591,6 +12591,14 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^3.0.0"
inherits "^2.0.1"

[email protected]:
version "4.4.0"
resolved "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz#d15bd259466a9d1accbdb2fe2fff17c52d030acb"
integrity sha512-Lek/TYp1+7g7I+uMfJnnSJ7YWoD58ajo6Oarhlex7lvUce+RCKRuGRSgztDO3/MF/PuGKmUL5iTHKf208UNszw==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
rollup-pluginutils "^2.8.1"

[email protected]:
version "10.1.0"
resolved "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz#417af3b54503878e084d127adf4d1caf8beb86fb"
Expand Down