Skip to content

Update console.build.js to set a value on window #5979

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

Merged
merged 1 commit into from
Feb 9, 2022
Merged
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
8 changes: 2 additions & 6 deletions packages/firestore-compat/tools/console.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,15 @@ const es5OutputOptions = {
format: 'iife'
};

const PREFIX = `
goog.module('firestore');
exports = eval(`;

const POSTFIX = ` + '${EXPORTNAME};');`;
const POSTFIX = `window['${EXPORTNAME}']=${EXPORTNAME};`;

async function build() {
const es5Bundle = await rollup.rollup(es5InputOptions);
const {
output: [{ code }]
} = await es5Bundle.generate(es5OutputOptions);

const output = `${PREFIX}${JSON.stringify(String(code))}${POSTFIX}`;
const output = `${String(code)}${POSTFIX}`;
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 that you need a newline or at least whitespace before ${POSTFIX} in order to match the code change in the CL. I guess the code always ends with a ; so it's probably okay either way, but just in case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Through experimentation, I am seeing that code ends with both a semicolon and newline. Do you think we should add another one?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably fine, I guess there was no newline in the previous version because it was JSON.stringified.


if (!fs.existsSync(OUTPUT_FOLDER)) {
fs.mkdirSync(OUTPUT_FOLDER);
Expand Down