-
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]: Yarn 3 support? #683
Comments
I am able to install on yarn v
Assuming this may also be related to module resolution using yarn 2? |
What node version are you on? |
I'm using node |
Also getting the following error when trying to run
But definitely did an install before running this! |
Seems like a linking issue. I don't have time to play with Yarn3 right now but if you would like to investigate and report back that would be awesome. We generally recommend to use NPM as that's what we test against, but we also use yarn1 without issue. |
Okay, thanks for having had a quick look into it and understand if this cannot be looked at further. Wouldn't really know where to start, but will check in again in a few months if support for Yarn 2/3/'Berry' would be provided by then. |
Just an FYI - I got remix to work a while back (as in March/April) with Yarn v2 PnP by patching diff --git a/compiler/assets.js b/compiler/assets.js
index c161dd31793837b2ce722ddbaa496f3d9c6b2bac..ef5989a66f30941bdb9cc884e70f62ec346c231b 100644
--- a/compiler/assets.js
+++ b/compiler/assets.js
@@ -30,7 +30,7 @@ async function createAssetsManifest(config, metafile) {
for (let key of Object.keys(metafile.outputs).sort()) {
let output = metafile.outputs[key];
if (!output.entryPoint) continue;
- let entryPointFile = path.resolve(output.entryPoint.replace(/(^browser-route-module:|\?browser$)/g, ""));
+ let entryPointFile = path.resolve(output.entryPoint.replace(/(^pnp:|^browser-route-module:|\?browser$)/g, ""));
if (entryPointFile === entryClientFile) {
entry = {
diff --git a/compiler.js b/compiler.js
index 86e2c589195f8e27560696891c09583d32d09e63..e79e849cd877ab10ced733f01a517bdf14aaabb9 100644
--- a/compiler.js
+++ b/compiler.js
@@ -9,6 +9,7 @@ var module$1 = require('module');
var esbuild = require('esbuild');
var debounce = require('lodash.debounce');
var chokidar = require('chokidar');
+var { pnpPlugin } = require('@yarnpkg/esbuild-plugin-pnp')
var build$1 = require('./build.js');
var config = require('./config.js');
var invariant = require('./invariant.js');
@@ -194,7 +195,7 @@ async function createBrowserBuild(config, options) {
define: {
"process.env.NODE_ENV": JSON.stringify(options.mode)
},
- plugins: [browserRouteModulesPlugin(config, /\?browser$/), emptyModulesPlugin(config, /\.server(\.[jt]sx?)?$/)]
+ plugins: [browserRouteModulesPlugin(config, /\?browser$/), emptyModulesPlugin(config, /\.server(\.[jt]sx?)?$/), pnpPlugin()]
});
}
@@ -234,7 +235,7 @@ async function createServerBuild(config, options) {
}
return false;
- })]
+ }), pnpPlugin()]
});
} The patch above of course won't work with the latest code, but back then it was possible to get it to work with PnP.. Remix does work with Yarn v3 if you're using "installConfig": {
"hoistingLimits": "workspaces"
} b/c Remix gets hoisted to the top-level
Without hoisting (using the
If you switch back/forth between the hoisting rules above, you should clear out
|
Thanks @rhefner - looks like it won't be too complicated to make remix work with Yarn 2/3 👍 |
Experiencing the same issue with yarn 3.1.1 + corepack. Just ran the tutorial:
|
@mihaa1 Don't know anything about corepack, but if I'm not mistaken, that error is coming from Yarn. Have you tried updating packageExtensions in For example:
|
I can also confirm that the install does not work with Yarn 2+ Plug N Play setup. The issue is mostly around the
When I then installed
|
I dug a bit deeper into what it would take to support yarn PnP, and these are my findings so far: TLDR: you're better off sticking to the
For reference, this is my current That's where I'm at now, I'll continue digging once I find some more time. |
I made some more progress! Clone and build my changed version of remix:
In the project you want to use yarn PnP in:
After that, you should be able to start the dev server using I hope I didn't forget anything. I'll draft a PR once I get around to get the |
Very interested in seeing if we can't find a solution to this soon. I'm a prolific YarnPnP user and Remix feels so right to me. Really excited to start using both together! |
I also ran into issues when I tried to upgrade yarn because When remix works correctly with yarn 2/3, I recommend also making sure the following works: yarn set version stable
yarn plugin import workspace-tools
yarn install
# This is the Yarn 3 replacement for yarn install --production
yarn workspaces focus --production |
Any progress on that, @cmd-johnson? Can give you a hand if needed. |
@tavoyne #1316 should be ready for merging, but feel free to test it yourself! |
#2359 has been merged and included in 1.3.4 which at least solves the basic setup for me. I was able to get the remix "basic" template working with 1.3.4 in a yarn 3 monorepo (using node_modules resolution) by:
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import type { MetaFunction } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import type { EntryContext } from "@remix-run/node";
import { RemixBrowser } from "@remix-run/react"; |
Somewhat related: when running
The same error appears when running |
Our guidance here is to get rid of all imports from |
@chaance This is has not been fixed — I still get an error when running
This may be solved by using Same error when using |
@lensbart Thanks for flagging, we'll take a look 👍 |
Hi, I am working on a Remix stack which happens to live in a Yarn 3 monorepo: VulcanJS/vulcan-npm#116 |
I got both Yarn 3 and monorepo working just by adding the |
Thank you, @MichaelDeBoey.
Not sure how I can go about fixing this issue. I tried adding Thoughts? |
I was experiencing this as well! I actually recognized this as To fix this, I'd normally use
const Module = require("node:module");
const { pnpPlugin } = require("@yarnpkg/esbuild-plugin-pnp");
const esbuild = require("esbuild");
const originalBuild = esbuild.build;
const build = (options) => {
return originalBuild({
...options,
plugins: [...options.plugins, pnpPlugin()],
});
};
const originalRequire = Module.prototype.require;
Module.prototype.require = function (id) {
if (id === "esbuild") {
return { ...esbuild, build };
}
return originalRequire.apply(this, arguments);
};
{
"scripts": {
"build": "NODE_OPTIONS=\"${NODE_OPTIONS} --require ./esbuild.register\" remix build",
"start:dev": "NODE_OPTIONS=\"${NODE_OPTIONS} --require ./esbuild.register\" remix dev"
}
} The next issue that I ran into was this:
Turns out, The issue is that to find the project's entry point, So, the last step was to diff --git a/compiler/assets.js b/compiler/assets.js
index c675d328d512ceff6e8e6c9f07578f132417d375..d837842d85a07158857778b00003a4ca089bd370 100644
--- a/compiler/assets.js
+++ b/compiler/assets.js
@@ -61,7 +61,7 @@ async function createAssetsManifest(config, metafile, cssModules) {
if (!output.entryPoint) continue;
let entryPointFile = path__namespace.resolve(output.entryPoint.replace(/(^browser-route-module:|\?browser$)/g, ""));
- if (entryPointFile === entryClientFile) {
+ if (entryPointFile.endsWith(entryClientFile)) {
entry = {
module: resolveUrl(key),
imports: resolveImports(output.imports)
After this patch was created and applied, I was able to get To the |
@ezracelli That's basically what I did in #1316 (https://github.com/remix-run/remix/pull/1316/files#diff-ef8b0a35f03b499672160742c2d6b9688717e8d6b923dde0e10d2631ab0c09d6) |
Small issue I am hitting: having a package-lock.json will stress out lerna (or lerna-lite) "publish" function, yet it's necessary for the Indie stack github actions to work ok Edit: ok I think I got it: in a monorepo you cannot have a Details of the error:
Is there a way to either force an npm install if no package-lock.json or to "fallback" to yarn elegantly? Related: bahmutov/npm-install#114 |
🤖 Hello there, We just published version Thanks! |
Closed by #1316 |
Thank you. Using the nightly build, I get the following warnings upon running
These can be muted by adding the following to packageExtensions:
# awaiting fix: https://github.com/remix-run/remix/issues/683
'@remix-run/server-runtime@*':
peerDependenciesMeta:
react:
optional: true
react-dom:
optional: true |
I’m still having a couple of issues when running Remix with Yarn v3.2.1, apart from the warning mentioned above:
I’m happy to help where I can, e.g. by submitting a PR for issue 1 ( Thanks in advance for your insight and consideration! |
@lensbart I think 3 is due to the ordering of the |
Created a small PR for 1. and 2. For issue 4, some more guidance would be welcome, to understand the current “happy path” and how my testing deviates from it. (Between parentheses: the script runs fine inside of a monorepo setup) |
Aha! What worked for me was swapping out Apologies for the many messages/notifications |
I managed to get it working without swapping to a different plugin, but #3579 wasn't enough. this line adds the This only happens when |
@skoging That was my lazy fix (and wasn't a fix at all), so I wouldn't look into it. I'm reverting it (and fixing the actual problem I was seeing) in PR #3633. I'm not sure re-ordering in this case is right, but there may be multiple issues going on here that we're all trying to fix separately. Are you getting the same errors as I mentioned in #3579? Or more like these errors? |
If some googlers are specifically looking for Yarn workspaces support, I've created a separate discussion: #3668 |
Which Remix packages are impacted?
remix
(Remix core)create-remix
What version of Remix are you using?
1.0.5
Steps to Reproduce
Trying to install dependencies with Yarn berry. My current Yarn version is
v3.2.0-rc.5
.Log file:
Dependencies in my
package.json
:Expected Behavior
Installation successful
Actual Behavior
Installation failed
The text was updated successfully, but these errors were encountered: