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.

[Reproducible] Can't resolve tilde ("~") included path #298

Open
@Liooo

Description

@Liooo

Create an app by tns create MY_PROJECT --template tns-template-hello-world-ng, setup nativescript-dev-webpack, and simply change this line from

import { ItemsComponent } from "./item/items.component";

to

import { ItemsComponent } from "~/item/items.component";

and run npm run start-android-bundle, then get the following error.

ERROR in Error encountered resolving symbol values statically. 

Could not resolve ~/item/items.component relative to /MY_PROJECT/app/app.routing.ts., 
resolving symbol AppRoutingModule in /MY_PROJECT/app/app.routing.ts,
resolving symbol AppRoutingModule in /MY_PROJECT/app/app.routing.ts,
resolving symbol AppRoutingModule in /MY_PROJECT/app/app.routing.ts


ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in '/MY_PROJECT/app'
 @ ./main.aot.ts 5:29-62

The same code builds and works successfully when running tns run android, so guess it's webpack's problem?

Here's the relative looking infos

package.json

  "nativescript": {
    "tns-android": {
      "version": "3.2.0"
    }
  },
  "dependencies": {
    "@angular/animations": "~4.4.1",
    "@angular/common": "~4.4.1",
    "@angular/compiler": "~4.4.1",
    "@angular/core": "~4.4.1",
    "@angular/forms": "~4.4.1",
    "@angular/http": "~4.4.1",
    "@angular/platform-browser": "~4.4.1",
    "@angular/router": "~4.4.1",
    "nativescript-angular": "~4.4.1",
    ....
},
  "devDependencies": {
    "@angular/compiler-cli": "~4.4.1",
    "@ngtools/webpack": "~1.6.0",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "copy-webpack-plugin": "~4.0.1",
    "extract-text-webpack-plugin": "~3.0.0",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-typescript": "~0.5.0",
    "nativescript-dev-webpack": "^0.8.0",
    "nativescript-worker-loader": "~0.8.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.1.0",
    "typescript": "~2.4.2",
    "webpack": "~3.2.0",
    "webpack-bundle-analyzer": "^2.8.2",
    "webpack-sources": "~1.0.1"
  },

tsconfig.json

{
    "compilerOptions": {
       ...
        "paths": {
            "~/*": [ "./app/*" ],
            "*": [
                "./node_modules/tns-core-modules/*",
                "./node_modules/*"
            ]
        }
      ...

webpack.config.js

        ...
        resolve: {
           ...
            alias: {
                '~': resolve("./app")
            },
        }
       ...

Anybody knows why?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions