Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Make the webpack dependencies prod dependencies of this plugin #569

Closed
1 task done
sis0k0 opened this issue Jun 16, 2018 · 1 comment
Closed
1 task done

Make the webpack dependencies prod dependencies of this plugin #569

sis0k0 opened this issue Jun 16, 2018 · 1 comment
Assignees
Labels

Comments

@sis0k0
Copy link
Contributor

sis0k0 commented Jun 16, 2018

Issue Checklist

  • You are submitting: a feature request

Current behaviour

Currently, when installing the nativescript-dev-webpack plugin, some development dependencies are added to the package.json of the project. These dependencies are needed for the webpack build.

Problems

  1. It's hard to upgrade to newer {N}-dev-webpack versions that require different dependencies. You have to manually invoke ./node_modules/.bin/update-ns-webpack --deps. This is a very annoying thing to do for all {N} apps and plugins in the {N} organisation.
  2. The dependencies list in the project's package.json gets huge and it's often hard to recognize which are the webpack dependencies.
  3. For Angular projects one of the added dependencies is @ngtools/webpack. However, the @angular-devkit/build-angular package has a dependency to @ngtools/webpack. That means that if your project has a dependency to @angular-devkit/build-angular (as the default NG web projects do), this can lead to multiple versions of the @ngtools/webpack plugin in your project. Having multiple versions of that plugin causes the webpack compilation to fail - https://github.com/angular/angular-cli/blob/master/packages/ngtools/webpack/src/loader.ts#L36-L43.

Proposed solution

Solution for 1. and 2. - all dependencies that are currently added to the project's package.json, will be dependencies of the nativescript-dev-webpack plugin. They won't be added to the project's package.json anymore.
Solution for 3. - all {N} Angular projects and templates should have a dependency to @angular-devkit/build-angular. That way, the {N}-dev-webpack plugin won't have to have a dependency to @ngtools/webpack, because the above is already brought to the project by @angular-devkit/build-angular.

Tasks breakdown

  1. Make all packages from the dependencyManager dependencies of the nativescript-dev-webpack plugin.
  2. Make the update-ns-webpack script remove all unneeded dependencies from the project.
  3. Make the update-ns-webpack script update or add if missing the @angular-devkit/build-angular and @angular/compiler-cli dependencies.
  4. Update all {N} apps in the {N} organization by removing their webpack dependencies.
  5. Add @angular-devkit/build-angular as dependency to all apps and templates in the {N} organization.
  6. Update @nativescript/schematics - remove the adding of webpack dependencies there.
@sis0k0 sis0k0 added the feature label Jun 16, 2018
@sis0k0 sis0k0 added this to the 0.13.1 milestone Jun 16, 2018
@sis0k0 sis0k0 self-assigned this Jun 16, 2018
@sis0k0 sis0k0 changed the title Make the webpack dependencies prod dependencies of the plugin Make the webpack dependencies prod dependencies of this plugin Jun 16, 2018
sis0k0 added a commit that referenced this issue Jun 20, 2018
implements #569 

BREAKING CHANGES:

The dependencies that were previously added by the nativescript-dev-webpack plugin to the project's package.json are now dependencies of the plugin itself.

MIGRATION:
1. Remove all obsolete dependencies from your project. You can do that by invoking the script:
```
./node_modules/.bin/update-ns-webpack --deps
```
2. [Angular] Add the following packages as devDependencies:
```
//package.json

"devDependencies": {
    "@angular-devkit/build-angular": "~0.7.0-rc.0",
    "@angular/compiler-cli": "~6.1.0-beta.1",
    //...
}
```
@sis0k0 sis0k0 removed this from the 0.14.1 milestone Jun 22, 2018
@sis0k0
Copy link
Contributor Author

sis0k0 commented Jun 22, 2018

Released with 0.14.0.

@sis0k0 sis0k0 closed this as completed Jun 22, 2018
sis0k0 added a commit that referenced this issue Jul 3, 2018
@angular-devkit/build-angular is not a dependency

Revert to adding @ngtools/webpack instead of
@angular-devkit/build-angular because the later is ~150mb bigger and
slows down the {N} cloud builds.
Add @ngtools/webpack to the project dependencies only if
@angular-devkit/build-angular isn't there already. That's because the
@angular-devkit/build-angular already depends on @ngtools/webpack. This will prevent the
plugin from adding multiple instances of @ngtools/webpack to the project
which would cause the build to fail.

related to #571, #569
sis0k0 added a commit that referenced this issue Jul 3, 2018
@angular-devkit/build-angular is not a dependency

Revert to adding @ngtools/webpack instead of
@angular-devkit/build-angular because the later is ~150mb bigger and
slows down the {N} cloud builds.
Add @ngtools/webpack to the project dependencies only if
@angular-devkit/build-angular isn't there already. That's because the
@angular-devkit/build-angular already depends on @ngtools/webpack. This will prevent the
plugin from adding multiple instances of @ngtools/webpack to the project
which would cause the build to fail.

related to #571, #569

fixes #595
sis0k0 added a commit that referenced this issue Jul 3, 2018
@angular-devkit/build-angular is not a dependency

Revert to adding @ngtools/webpack instead of
@angular-devkit/build-angular because the later is ~150mb bigger and
slows down the {N} cloud builds.
Add @ngtools/webpack to the project dependencies only if
@angular-devkit/build-angular isn't there already. That's because the
@angular-devkit/build-angular already depends on @ngtools/webpack. This will prevent the
plugin from adding multiple instances of @ngtools/webpack to the project
which would cause the build to fail.

related to #571, #569

BREAKING CHANGES

Not really a breaking change but:
It's a good idea to remove the `@angular-devkit/build-angular` from the
package.json and add `@ngtools/webpack` instead as this will speed up
the build.

fixes #595
sis0k0 added a commit that referenced this issue Jul 4, 2018
…ld-angular is not a dependency (#594)

* fix: add @ngtools/webpack to project deps only if
@angular-devkit/build-angular is not a dependency

Revert to adding @ngtools/webpack instead of
@angular-devkit/build-angular because the later is ~150mb bigger and
slows down the {N} cloud builds.
Add @ngtools/webpack to the project dependencies only if
@angular-devkit/build-angular isn't there already. That's because the
@angular-devkit/build-angular already depends on @ngtools/webpack. This will prevent the
plugin from adding multiple instances of @ngtools/webpack to the project
which would cause the build to fail.

related to #571, #569

BREAKING CHANGES

Not really a breaking change but:
It's a good idea to remove the `@angular-devkit/build-angular` from the
package.json and add `@ngtools/webpack` instead as this will speed up
the build.

fixes #595

* test(e2e): update demo Angular deps
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant