-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
bug: server only built-ins polyfilled in client bundle #4299
Conversation
|
Hi @p-m-p, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Are you editing the |
Only to verify what I thought to be the issue. I might consider that as a temporary solution though, thanks. I'd still like to get to the bottom of the issue, if I try a similar import in the application code there is no issue so seem to only be from third party libraries. |
I spent some time looking into this and have resolved the initial error by renaming the imported file with the suffix If you do import from a built-in or a module that depends on one to use in server only code in a route and the polyfill does not implement it then you'll see an error like with I see there is an open pull request on the plugins package for some time, perhaps bringing this change in as a maintained plugin would be a better choice? I could potentially help out here now I am familiar with the code but perhaps this issue raises a question if use of the plugins should actually be removed instead? |
Closed by #5274 |
🤖 Hello there, We just published version Thanks! |
@@ -47,30 +47,37 @@ test.beforeAll(async () => { | |||
// `createFixture` will make an app and run your tests against it. | |||
//////////////////////////////////////////////////////////////////////////// | |||
files: { | |||
// XXX Remove .server from file for missing polyfill method error | |||
"app/api/client.server.js": js` | |||
import { AccountInfo } from '@azure/msal-node'; |
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 lib is not meant to be utilized in the browser and is expected to require / use a bunch of node polyfills.
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.
The issue I faced here was with using from a loader in a route which perhaps is considered client code but that wasn't clear to me. I did solve it as per my previous comment by renaming the included file with .server.ts
to it wasn't bundled but left this here due to the issue with the polyfills that looks to be closed now so is likely no longer an issue.
Hi, I've been unable to update
@azure/msal-node
library since version1.12.1
due to the introduction of the loopback listener which importscreateServer
from thehttp
builtin as per below.From what I can tell from the error message it is trying to resolve from the rollup http polyfill plugin that doesn't implement this method. I tried adding the library to
serverDependenciesToBundle
but that didn't seem to solve anything and if I edit the imported file in node_modules to justimport http from 'http';
everything builds and runs as expected.Appreciate any help or direction to getting this resolved. Thanks.