question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[es-dev-server]: node resolution with yarn workspaces goes out of the root directory

See original GitHub issue

I’m trying to create a mono repo using yarn workspaces, with an example directory where I want to run es-dev-server.

root
  |
  |__ example
  |          |_ node_modules (empty as everything has been hoisted)
  |          |_ Trying to run es-dev-server here        
  |
  |___ node_modules
             |_ This is the actual place where `import "anything"` resolves to

When I try to run es-dev-server it gives the error

Error compiling: Import “tslib” resolved to the file “/home/viks/root/node_modules/tslib/tslib.es6.js” which is outside the web server root, and cannot be served by es-dev-server. Install the module locally in the current project, or expand the root directory. If this is a symlink or if you used npm link, you can run es-dev-server with the --preserve-symlinks option

I’m using yarn and don’t want to fallback to using npm with npm link. Changing the rootDir is also cumbersome since too many paths have to be adjusted in a non-trivial manner.

Can we get an option to specify a separate workspaceRoot that default to rootDir but can be above rootDir if needed?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
LarsDenBakkercommented, May 1, 2020

We had some discussions in the team about the multiple directories, but not everyone was quite convinced 😃

2reactions
LarsDenBakkercommented, May 20, 2020

Perhaps we need to make this more explicit in the docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Yarn decide "put" some dependencies in the workspace, not ...
I have a project made of two workspaces: client (Angular 8) in packages/client; server (NestJS) in packages/server. This is the root ...
Read more >
Detect "node-modules" under "packages" folder, remove them ...
Possible solution. I suggest we detect if there is a “node_modules” folder under the packages folder, we remove it and we launch again ......
Read more >
this experimental syntax requires enabling the parser plugin
Solution 1. Install dependencies needed to enable babel to properly parse jsx. Specify parser in .eslintrc.json (so your console and VSCode will use...
Read more >
Systemjs: AMD, CJS & ES6 Spec-compliant Module Loader
SystemJS is a hookable, standards-based module loader. It provides a workflow where code written for production workflows of native ES modules in browsers...
Read more >
Index of /groups/npm-public
Name, Last Modified, Size, Description. Parent Directory · 1/, Wed Aug 03 18:27:26 CST 2022. 2-thenable/, Sat Aug 07 18:45:16 CST 2021.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found