incompatibility with yarn workspaces
zvictor opened this issue · 4 comments
The problem
While using graphpack in a multi projects setup with yarn, the error below is thrown.
As a workaround, the whole project using graphpack can be moved to yarn's nohoist.
The workaround
package.json:
{
"workspaces": {
"packages": [
"applications/**/*"
],
"nohoist": [
"appname-with-graphpack/**"
]
}
}
The error
error in /my-app/node_modules/graphpack/lib/server.js
Module build failed (from /my-app/node_modules/graphpack/node_modules/babel-loader/lib/index.js):
Error: [BABEL] /my-app/node_modules/graphpack/lib/server.js: Cannot find module '@babel/preset-typescript' from '/my-app/applications/appname'
at Function.module.exports [as sync] (/my-app/node_modules/resolve/lib/sync.js:43:15)
at resolveStandardizedName (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePreset (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/files/plugins.js:58:10)
at loadPreset (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/files/plugins.js:77:20)
at createDescriptor (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at items.map (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at presets (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
@ multi graphpack
/my-app/node_modules/graphpack/bin/graphpack.js:16
throw Error(error || stats.toJson().errors);
^
Error: /my-app/node_modules/graphpack/lib/server.js
Module build failed (from /my-app/node_modules/graphpack/node_modules/babel-loader/lib/index.js):
Error: [BABEL] /my-app/node_modules/graphpack/lib/server.js: Cannot find module '@babel/preset-typescript' from '/my-app/applications/appname'
at Function.module.exports [as sync] (/my-app/node_modules/resolve/lib/sync.js:43:15)
at resolveStandardizedName (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePreset (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/files/plugins.js:58:10)
at loadPreset (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/files/plugins.js:77:20)
at createDescriptor (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at items.map (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at presets (/my-app/node_modules/graphpack/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
@ multi graphpack index[0]
at Watching.compiler.watch.once (/my-app/node_modules/graphpack/bin/graphpack.js:16:15)
at Watching.<anonymous> (/my-app/node_modules/graphpack/node_modules/ramda/src/once.js:34:17)
at Watching.handler (/my-app/node_modules/graphpack/node_modules/ramda/src/internal/_arity.js:14:19)
at compiler.hooks.done.callAsync (/my-app/node_modules/graphpack/node_modules/webpack/lib/Watching.js:98:9)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:15:1)
at AsyncSeriesHook.lazyCompileHook (/my-app/node_modules/tapable/lib/Hook.js:154:20)
at Watching._done (/my-app/node_modules/graphpack/node_modules/webpack/lib/Watching.js:97:28)
at onCompiled (/my-app/node_modules/graphpack/node_modules/webpack/lib/Watching.js:47:18)
at hooks.afterCompile.callAsync.err (/my-app/node_modules/graphpack/node_modules/webpack/lib/Compiler.js:552:14)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/my-app/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:15:1)
error Command failed with exit code 1.
@zvictor Thanks for filing this! Maybe worth to put instructions about nohoist
to README.md? WDYT?
I was actually hoping that we could figure why @babel/preset-typescript
can't be found and fix it in a way that it would work regardless of how we are installing our packages.
Using nohoist
should only be needed on legacy projects, and I honestly don't feel comfortable having to make a trade-off right on the first dependency of my new project based on graphpack 😕
maybe related, but even with nohoist
, I'm getting this issue:
$ graphpack dev
🐠 Using babel.config.js defined in your app root
[BABEL] Note: The code generator has deoptimised the styling of /Users/vincentspeelman/Projects/TED/audacious-project-org/node_modules/graphql-upload/node_modules/busboy/deps/encoding/encoding-indexes.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/vincentspeelman/Projects/TED/audacious-project-org/node_modules/busboy/deps/encoding/encoding-indexes.js as it exceeds the max of 500KB
which eventually runs out of memory.
Any thoughts?
I've tried defining my own babel config and tried without one