Support Bazel workspace (or any non-npm workspace)
xgwang-scienceos opened this issue · 0 comments
Description
In vscode, when working on a package under a Bazel workspace, the bazel build
command will generate the node_modules
directory in separate directory, instead of directly under the package itself. This causes the svelte language server not able to properly lint modules.
Here is an example error:
Error in svelte.config.js
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sveltejs/adapter-auto' imported from /Users/<user>/<bazel-workspace-root>/<bazel-svelte-package>/svelte.config.js
Here is an example file directory:
- <bazel-workspace-root>/
- WORKSPACE
- <bazel-svelte-package>/
- src/
- static/
- BUILD
- package.json
- svelte.config.js
I wonder if we can consider adding language server support for Bazel workspace, or any non-npm workspace where the node_modules
directory is not located directly under the package itself?
Proposed solution
After creating a Svelte project in a Bazel workspace, the Svelte language server will work after running Bazel build
on the Svelte Bazel target. At this point, a node_modules
directory is created by Bazel, e.g. $(bazel info bazel-bin)/node_modes
. The Svelte language server should be able to properly lint node modules in the Bazel created node_modules
directory.
Alternatives
No response