-
Notifications
You must be signed in to change notification settings - Fork 926
Add Node.js support to Storage v9 #4985
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
Conversation
|
Binary Size ReportAffected SDKs
Test Logs |
Size Analysis Report |
Tested this locally in Node:
I did have to manually change the "main" entry in node_modules/@firebase/storage/package.json to "main": "exp/dist/index.node.cjs.js" (for v9). Not sure where this gets generated. |
@@ -0,0 +1,19 @@ | |||
<component name="ProjectRunConfigurationManager"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is basically the entire reason behind this PR. I want to be able to debug Storage tests in IntelliJ. Since it is not harmful for VSCode users, I'd like to leave it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Should we follow the same folder structure in Firestore, i.e. .idea/runConfigurations
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like IntelliJ changed the locations. All new profiles are added under .run
|
||
// This file is only used under ts-node. | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports | ||
const platform = require(`./${process.env.TEST_PLATFORM ?? 'node'}/base64`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is TEST_PLATFORM
set? Do we always default to node
currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to set it. It is meant to be overridden for the Karma browser run. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually seems it's unnecessary to set it, because we default to browser
in the webpack.config if TEST_PLATFORM
is not set.
I think it also means we can just import ./node/base64
here since this file is only used for node tests as you pointed out in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I simplified it.
woohoo! ❤️ |
Addresses #18 |
@schmidt-sebastian how hard would it be to port this to v8 as well? |
@samtstern Pretty easy, we likely only need a new Rollup config. We would have to change the "main" entry in the package.json to point to the new build, which is probably a breaking change. That's why I did not do this so far. |
cc @yuchenshi |
This adds Node support to Storage (via node-fetch).
It uses the same platform injection logic that Firestore uses.