-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Description
For a bit of context: I recently started fiddling with converting a couple of my projects to a monorepo using yarn workspaces. One of the downstream dependencies of one of my addons is ember-cli-dropzonejs.
I am getting an error when trying to resolve the dropzone dependency, I believe originating from treeForVendor and treeForStyles, which use this.project.root as the directory root when including dropzone in the vendor tree. Since dependencies are hoisted to the parent of the workspace, dropzone cannot be resolved and the following error is given:
Directory not found: /path/to/parent/workspace-a/node_modules/dropzone/dist/min
Lines 14 to 17 in 7e26e6c
| var dropzoneJs = new Funnel( | |
| path.join(this.project.root, 'node_modules', 'dropzone/dist/min'), | |
| { files: ['dropzone.min.js'] } | |
| ); |
Project layout, in case it is useful
-> parent
-> node_modules/
-> ember-cli-dropzonejs/
-> dropzone/
-> workspace-a/ [this.project.root]
Proposal
Use require.resolve to locate the needed dropzone dependency. This should follow the expected resolution whether in a workspace or not. Inspiration taken from ember-highcharts:
https://github.com/ahmadsoe/ember-highcharts/blob/4a326f0528bcf6236e18fa44ebbe30a185dc271d/index.js#L86-L98
Example:
var dropzoneJs = new Funnel(
path.join(path.dirname(require.resolve('dropzone')), 'min'),
{ files: ['dropzone.min.js'] }
);