Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage in yarn workspaces #115

Open
daniellubovich opened this issue Aug 20, 2020 · 0 comments
Open

Usage in yarn workspaces #115

daniellubovich opened this issue Aug 20, 2020 · 0 comments

Comments

@daniellubovich
Copy link

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

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:

https://github.com/daniellubovich/ember-cli-dropzonejs/blob/a83b70dd7d36c415b3b196520668eccd46dcbd69/index.js#L14-L17

    var dropzoneJs = new Funnel(
      path.join(path.dirname(require.resolve('dropzone')), 'min'),
      { files: ['dropzone.min.js'] }
    );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant