Skip to content

Commit dd9aa32

Browse files
Fix prepare of scoped plugins (#3080)
In case a plugin depends on a scoped package, for example `@angular/core`, trying to use the plugin from local path with npm 5 will fail. The recommended approach is to declare the scoped package (`@angular/core`) as a devDependency of the plugin. After that, declare both the plugin and the scoped package as dependencies of your project. In case the plugin is installed from local directory, npm 5 creates symlink in node_modules. This means that all files inside `<plugins dir>/node_modules` will be visible for CLI, including the dev dependencies. During project preparation CLI copies `node_modules` from the project to `<project dir>/platforms/<platform>...` directory. We have a specific logic to process only dependencies of each package, i.e. we should remove `@angular/core` from the plugin's node_modules direcotry. However, the logic is not working correctly as instead of using the name `@angular/core` it's been trying to remove `core` only. Fix getting names of the dependencies, so we'll be able to remove the scoped packages as well.
1 parent 5fc07a7 commit dd9aa32

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/tools/node-modules/node-modules-dest-copy.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export class TnsModulesCopy {
6565
const dependencies = _.flatten(this.$fs.readDirectory(dependenciesFolder)
6666
.map(dir => {
6767
if (_.startsWith(dir, "@")) {
68-
return this.$fs.readDirectory(path.join(dependenciesFolder, dir));
68+
const pathToDir = path.join(dependenciesFolder, dir);
69+
const contents = this.$fs.readDirectory(pathToDir);
70+
return _.map(contents, subDir => `${dir}/${subDir}`);
6971
}
7072

7173
return dir;

0 commit comments

Comments
 (0)