Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.
This repository was archived by the owner on May 1, 2020. It is now read-only.

Dev build/ionic serve fail when using globally-defined types. #163

Closed
@JustinPierce

Description

@JustinPierce

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

Using the ionic-app-scripts@0.0.33 (or any version greater than 0.0.30), building with --dev (and, by extension, ionic serve) will fail if you reference types that are defined globally. Specific examples that I've seen are @types/jasmine and @types/googlemaps. Neither of these packages declares a module that can be imported with an import statement.

A production build completes successfully, and a dev build completes successfully on ionic-app-scripts@0.0.30.

What behavior are you expecting?

I expect the build to complete successfully. 😉

Steps to reproduce:

  1. Create a test project (ionic start test --v2)
  2. Update dependencies to use ionic-app-scripts@0.0.33, if the starter still does not reference it.
  3. Optional sanity build (npm run build --dev). This build should be successful.
  4. Install a type definition that defines everything globally (npm install --save @types/googlemaps).
  5. Reference one of those types. I added public thingy: google.maps.places.PlaceResult = null; to src/pages/home/home.ts.
  6. Attempt a dev build. This build should fail with something similar to the following:
> ionic-hello-world@ build C:\Source\GitHub\test
> ionic-app-scripts build

[09:47:19]  ionic-app-scripts 0.0.33
[09:47:19]  build dev started ...
[09:47:19]  clean started ...
[09:47:19]  clean finished in 9 ms
[09:47:19]  copy started ...
[09:47:19]  transpile started ...
[09:47:19]  lint started ...
[09:47:21]  lint finished in 1.90 s
[09:47:22]  typescript: C:/Source/GitHub/test/src/pages/home/home.ts, line: 10
            Cannot find namespace 'google'.

       L9:  export class HomePage {
      L10:    public thingy: google.maps.places.PlaceResult = null;

[09:47:22]  transpile failed
[09:47:22]  ionic-app-script task: "build"
[09:47:22]  Error: Error

Which @ionic/app-scripts version are you using?

0.0.33

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

I'm developing on Windows. I haven't tried this on another OS, but I know there have been some Windows-specific issues with the last few versions of ionic-app-scripts.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions