Skip to content
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

Privately linked workspace packages are failling rsw watch #35

Open
dmtrKovalenko opened this issue Jul 30, 2022 · 1 comment
Open

Privately linked workspace packages are failling rsw watch #35

dmtrKovalenko opened this issue Jul 30, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@dmtrKovalenko
Copy link

Describe the bug
I upgraded to 2.0.1 and when I am doing the yarn rsw watch it compiles and fails with an error that my private package is not found on npm registry

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.yarnpkg.com/fframes-editor - Not found
npm ERR! 404 
npm ERR! 404  'fframes-editor@*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dmtrkovalenko/.npm/_logs/2022-07-30T17_38_35_553Z-debug.log

To Reproduce
Steps to reproduce the behavior:

  1. Create yarn workspace
  2. Add private package
  3. Link this package as dependency "your-package-name": "*" to your frontend vite project
  4. Ryn yarn rsw watch

Expected behavior
No error occurred

Desktop (please complete the following information):

  • OS: MacOS
  • Version 2.0.1
@dmtrKovalenko dmtrKovalenko added the bug Something isn't working label Jul 30, 2022
@lencx
Copy link
Member

lencx commented Jul 31, 2022

Please check the following steps to see if there are any omissions.
You can refer to the related configuration of lencx/OhMyBox, and also supports building projects using github action.

Step1

Install the latest version of rsw and vite-plugin-rsw:

# v0.7.10
cargo install rsw

# v2.0.8
yarn add vite-plugin-rsw@latest

Step2

Add rsw to package.json:

"scripts": {
    "dev": "vite",
    "rsw": "rsw",
    "build": "rsw build && tsc && vite build",
}

Edit vite.config.ts:

import { defineConfig } from 'vite';
import ViteRsw from 'vite-plugin-rsw';

export default defineConfig({
  plugins: [
    ViteRsw(),
  ],
})

Step3

Initial rsw.toml configuration:

yarn rsw init

Generate rust crate:

# rust crate (npm package)
yarn rsw new my-wasm

Edit rsw.toml:

# link type: npm | yarn | pnpm, default is `npm`
cli = "yarn"

[[crates]]
name = "my-wasm"
# <npm|yarn|pnpm> link
# ⚠️ Note: must be set to `true`, default is `false`
link = true

Step4

Run rsw watch:

# rust crates - automatic build
# ⚠️ Note: Do not exit the process after the command has started.
yarn rsw watch

Run dev:

# Front-end: start dev server
yarn dev

Step5

Build wasm alone:

yarn rsw build

Build the project:

# rsw build && tsc && vite build
yarn build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants