You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to integrate onestack to an existing monorepo but it doesn't compile correctly. At first I thought it could be due to conflicts with my existing monorepo but even an empty one doesn't seem to work.
Repro steps:
Create brand new folder monorepo and run git init.
create an onestack project called app via pnpx one@latest and use minimal tamagui app with pnpm as package manager.
Go to do the root cd .. and add gitignore file with the following content.
node_modules/
run git add -A and commit the initial empty onestack app.
run git clean -xdf :/ from the root to remove all untracked files.
run pnpm install from the root.
from root run the the app via pnpm --filter app dev. You will see the following error
Error
pnpm --filter app dev
> [email protected] dev /Users/prabirshrestha/code/tmp/monorepo/apps/app
> one dev
✘ [ERROR] Could not resolve "@tamagui/shorthands/v2"
config/tamagui/tamagui.config.ts:2:27:
2 │ import { shorthands } from '@tamagui/shorthands/v2'
╵ ~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "@tamagui/shorthands/v2" as external to exclude it from the bundle, which
will remove this error and leave the unresolved path in the bundle.
✘ [ERROR] Could not resolve "@tamagui/animations-css"
config/tamagui/animations.ts:1:33:
1 │ import { createAnimations } from '@tamagui/animations-css'
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "@tamagui/animations-css" as external to exclude it from the bundle, which
will remove this error and leave the unresolved path in the bundle.
Error bundling tamagui config: Build failed with 2 errors:
config/tamagui/animations.ts:1:33: ERROR: Could not resolve "@tamagui/animations-css"
config/tamagui/tamagui.config.ts:2:27: ERROR: Could not resolve "@tamagui/shorthands/v2" (run with DEBUG=tamagui to see stack)
No bundled config generated, maybe an error in bundling. Set DEBUG=tamagui and re-run to get logs.
[vite] connected.
11:59:41 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
Cannot optimize dependency: react-native-safe-area-context, present in ssr 'optimizeDeps.include'
Error: The following dependencies are imported but could not be resolved:
@tamagui/shorthands/v2 (imported by /Users/prabirshrestha/code/tmp/monorepo/apps/app/config/tamagui/tamagui.config.ts)
@tamagui/animations-css (imported by /Users/prabirshrestha/code/tmp/monorepo/apps/app/config/tamagui/animations.ts)
Are they installed?
at file:///Users/prabirshrestha/code/tmp/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-BZ_CwQkz.js:37640:15
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async file:///Users/prabirshrestha/code/tmp/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-BZ_CwQkz.js:66107:28
11:59:41 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
✘ [ERROR] Could not read from file: /Users/prabirshrestha/code/tmp/monorepo/apps/app/@vxrn/safe-area
../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_@babel+c_63bszf4fyn7ejgs7ng7ki2xwkq/node_modules/one/dist/esm/index.mjs:10:29:
10 │ import { SafeAreaView } from "react-native-safe-area-context";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:59:42 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
11:59:42 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
11:59:42 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
11:59:42 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
11:59:42 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
11:59:42 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
11:59:42 PM [vite] (ssr) warning: rewrote react-native-safe-area-context to @vxrn/safe-area but was not an abolute path and was not handled by other plugins. This will lead to duplicated modules for the same path. To avoid duplicating modules, you should resolve to an absolute path.
Plugin: alias
ERROR Build failed with 1 error: 11:59:42 PM
../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_@babel+c_63bszf4fyn7ejgs7ng7ki2xwkq/node_modules/one/dist/esm/index.mjs:10:29: ERROR: Could not read from file: /Users/prabirshrestha/code/tmp/monorepo/apps/app/@vxrn/safe-area
../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_@babel+c_63bszf4fyn7ejgs7ng7ki2xwkq/node_modules/one/dist/esm/index.mjs:10:29: ERROR: Could not read from file: @vxrn/safe-area
at failureErrorWithLog (/Users/prabirshrestha/code/tmp/monorepo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1472:15)
at /Users/prabirshrestha/code/tmp/monorepo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:945:25
at /Users/prabirshrestha/code/tmp/monorepo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1353:9
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
ERROR Build failed with 1 error: 11:59:42 PM
../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_@babel+c_63bszf4fyn7ejgs7ng7ki2xwkq/node_modules/one/dist/esm/index.mjs:10:29: ERROR: Could not read from file: /Users/prabirshrestha/code/tmp/monorepo/apps/app/@vxrn/safe-area
/Users/prabirshrestha/code/tmp/monorepo/apps/app:
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL [email protected] dev: `one dev`
Exit status 1
Finally found the root cause. Seems like it does create .nmprc with node-linker=hoisted but at apps/app/.npmrc instead of the root besides pnpm-workspace.yaml. Moving .npmrc file worked.
pnpx one@latest should be smart to detect this and create .npmrc file in the appropriate place.
zetavg
changed the title
one doesn't work on an existing monorepo
[create] place .npmrc in the correct place if creating app within existing pnpm monorepo
Nov 16, 2024
I was trying to integrate onestack to an existing monorepo but it doesn't compile correctly. At first I thought it could be due to conflicts with my existing monorepo but even an empty one doesn't seem to work.
Repro steps:
monorepo
and rungit init
.package.json
pnpm-workspace.yaml
file.mkdir apps
.cd apps
app
viapnpx one@latest
and useminimal tamagui app
withpnpm
as package manager.cd ..
and add gitignore file with the following content.git add -A
and commit the initial empty onestack app.git clean -xdf :/
from the root to remove all untracked files.pnpm install
from the root.pnpm --filter app dev
. You will see the following errorError
Packages are installed in the app folder
The text was updated successfully, but these errors were encountered: