-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Do you want to request a feature or report a bug?
bug?
What is the current behavior?
We are using node_modules inside src folder for symlinking to have short absolute imports for commonly used folders:
src/
types/
node_modules/
types/ (symlink)
...
...
With PnP this behaviour is lost:
Error: You cannot require a package ("types") that is not declared in your dependencies (via "src/api/client.ts")
Symlinks are a nice tool-agnostic way of enabling this, see Dan's comment - facebook/create-react-app#5136 (comment)
If the current behavior is a bug, please provide the steps to reproduce.
- Symlink some source file or folder to any
node_modulesfolder - Import that folder using absolute import
- Run the code
What is the expected behavior?
PnP should either provide a way to allow locally symlinked source folders through or
document migration path / alternatives.
One option would be to write all those imports to relative, as they are a bit magic - making it a bit hard to distinguish between published modules and local. Although in the project I'm testing PnP, there are a few thousand absolute imports.
@arcanis Any ideas?
Please mention your node.js, yarn and operating system version.
Node.js v10.13.0
Yarn v1.12.1 with --pnp enabled
macOS 10.12.6
Webpack 4.20.2
pnp-webpack-plugin 1.2.0
ts-loader 5.3.0