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

Project created with Sidekick is missing webpack.config and hooks #494

Closed
@rosen-vladimirov

Description

@rosen-vladimirov

Issue Checklist

Tell us about the problem

Creating project in Sidekick leaves it without webpack.config and hooks in some cases, but the template has a dependency to nativescript-dev-webpack.

Steps to reproduce

  1. Create new project in Sidekick
  2. Build the project
  3. Create another project
  4. Check the latest project you've created - it does not have webpack.config.js and several hooks are missing

The problem is that once a project is built, the INIT_CWD environment variable is set to the project directory of the project. When creating a new project after that, the INIT_CWD still points to the same location. The new project has a dependency to nativescript-hook which respects the INIT_CWD variable. After that it detects that all hooks are already installed in the searched location (the first project) and doesn't do anything. So the new project does not receive the required hooks. Same is valid for webpack.config.js - nativescript-hook respects the INIT_CWD variable and returns the value for a project dir. The postinstall of nativescript-dev-webpack detects there's webpack.config.js in the path returned from nativescript-hook and doesn't add a new one.

The main problem is that we set the value of INIT_CWD in the nativescript-dev-webpack hooks. We should just read it and use it when npm CLI has set it.

Local environment

  • Platform: all
  • Node version 6.x.x IMPORTANT: Your npm version should be 3.x.x or 4.x.x
  • NativeScript CLI version 4.0.0

Project data

  • Platform you are building the app for: both
  • Node dependencies:
{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.sidekickblankangular"
  },
  "dependencies": {
    "@angular/animations": "~5.2.0",
    "@angular/common": "~5.2.0",
    "@angular/compiler": "~5.2.0",
    "@angular/core": "~5.2.0",
    "@angular/forms": "~5.2.0",
    "@angular/http": "~5.2.0",
    "@angular/platform-browser": "~5.2.0",
    "@angular/platform-browser-dynamic": "~5.2.0",
    "@angular/router": "~5.2.0",
    "nativescript-angular": "~5.3.0",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.10",
    "rxjs": "~5.5.5",
    "tns-core-modules": "4.0.0",
    "zone.js": "~0.8.18"
  },
  "devDependencies": {
    "nativescript-dev-typescript": "~0.7.0",
    "nativescript-dev-webpack": "~0.10.0",
    "typescript": "~2.7.2",
    "webpack": "~3.10.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-sources": "~1.1.0",
    "clean-webpack-plugin": "~0.1.19",
    "copy-webpack-plugin": "~4.3.0",
    "raw-loader": "~0.5.1",
    "css-loader": "~0.28.7",
    "nativescript-worker-loader": "~0.8.1",
    "resolve-url-loader": "~2.2.1",
    "extract-text-webpack-plugin": "~3.0.2",
    "uglifyjs-webpack-plugin": "~1.1.6",
    "@angular/compiler-cli": "~5.2.0",
    "@ngtools/webpack": "~1.9.4"
  }
}

  • Webpack configuration:
default one

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions