Skip to content

tns run android --bundle doesn't pause on webpack compilation error  #3785

Closed

Description

@sis0k0

Please, provide the details below:

Tell us about the problem

When you run tns run android --bundle and the webpack compilation fails, the CLI continues with native build, installing the app, etc. It should fail instead.

Note: tns build android --bundle works correctly.

Which platform(s) does your issue occur on?

I tested it only on Android.

Please provide the following version numbers that your issue occurs with:

  • CLI: next, reproducible with 4.1.2 too
  • Cross-platform modules: next
  • Runtime(s): next
  • Plugin(s): nativescript-dev-webpack is next

Please tell us how to recreate the issue in as much detail as possible.

Using the attached project:

tns run android --bundle

Is there code involved? If so, please share the minimal amount of code needed to

The attached project has an invalid require.
jsapp.tar.gz

Activity

  1. cowboyd commented on Mar 21, 2019

    @cowboyd

    This happens on ios with webpack as well. Here is a repository that reproduces the error: https://github.com/resideo-platform/exemplar/

    You can introduce a syntax error into the typescript.

    1. compilation fails
    2. it goes ahead and tries to deploy the app
    ❯❯❯❯ yarn start ios                                                                                                                     ~/C/N/exemplar master
    yarn run v1.13.0
    $ tns run ios
    Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
    Searching for devices...
    Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398
    Hook skipped because bundling is in progress.
    Running webpack for iOS...
    File change detected. Starting incremental webpack compilation...
    
    webpack is watching the files…
    
    Hash: bd64d6d5b40ba781b911
    Version: webpack 4.27.1
    Time: 3370ms
    Built at: 03/21/2019 2:55:18 PM
                                                                                                Asset       Size  Chunks             Chunk Names
                                   App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json   2.31 KiB          [emitted]
                                   App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png   98.7 KiB          [emitted]
                                     App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png    1.2 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png   3.61 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png   6.68 KiB          [emitted]
                                     App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png   1.64 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png   4.73 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png   9.24 KiB          [emitted]
                                     App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png    2.6 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png   7.59 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png   14.7 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png   14.7 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png   31.4 KiB          [emitted]
                                     App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png   7.24 KiB          [emitted]
                                  App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png   22.3 KiB          [emitted]
                                App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png   27.6 KiB          [emitted]
                                                      App_Resources/iOS/Assets.xcassets/Contents.json   62 bytes          [emitted]
                              App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json    5.1 KiB          [emitted]
                          App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png    160 KiB          [emitted]
                        App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png   62.2 KiB          [emitted]
                        App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png    112 KiB          [emitted]
                        App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png    180 KiB          [emitted]
                    App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png    165 KiB          [emitted]
                   App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png   43.2 KiB          [emitted]
               App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png   71.5 KiB          [emitted]
                      App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png   60.9 KiB          [emitted]
                   App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png    187 KiB          [emitted]
                   App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png    198 KiB          [emitted]
                    App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png   43.4 KiB          [emitted]
                App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png   72.7 KiB          [emitted]
                       App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png   59.5 KiB          [emitted]
                    App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png    182 KiB          [emitted]
                                App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png   20.3 KiB          [emitted]
                             App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png   61.4 KiB          [emitted]
                     App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json  426 bytes          [emitted]
       App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png   1.67 KiB          [emitted]
    App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png    3.9 KiB          [emitted]
    App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen.AspectFill@3x.png   34.4 KiB          [emitted]
                         App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json  414 bytes          [emitted]
               App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png   65.3 KiB          [emitted]
            App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png    202 KiB          [emitted]
            App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen.Center@3x.png   91.9 KiB          [emitted]
                                                                         App_Resources/iOS/Info.plist   1.49 KiB          [emitted]
                                                            App_Resources/iOS/LaunchScreen.storyboard   4.04 KiB          [emitted]
                                                                     App_Resources/iOS/build.xcconfig  504 bytes          [emitted]
                                                                                            bundle.js   32.4 KiB  bundle  [emitted]  bundle
                                                                                         package.json   82 bytes          [emitted]
                                                                                           starter.js   39 bytes          [emitted]
                                                                                            vendor.js   1.39 MiB  vendor  [emitted]  vendor
    Entrypoint bundle = vendor.js bundle.js
    [./app.css] 922 bytes {bundle} [built]
    [./main.ts] 926 bytes {bundle} [built]
    [./package.json] 73 bytes {bundle} [optional] [built]
        + 154 hidden modules
    
    ERROR in src/main.ts(1,6): error TS1005: ';' expected.
    src/main.ts(1,20): error TS1005: '=' expected.
    src/main.ts(1,23): error TS1005: ';' expected.
    src/main.ts(1,38): error TS1005: ';' expected.
    src/main.ts(1,41): error TS1005: ';' expected.
    src/main.ts(1,46): error TS1005: ';' expected.
    src/main.ts(1,51): error TS1005: ';' expected.
    src/main.ts(1,60): error TS1005: ';' expected.
    src/main.ts(1,75): error TS1005: ',' expected.
    src/main.ts(1,83): error TS1005: ',' expected.
    src/main.ts(1,87): error TS1005: ',' expected.
    
    Webpack compilation complete. Watching for file changes.
    Webpack build done!
    Hook skipped because either bundling or livesync is in progress.
    Preparing project...
    Project successfully prepared (iOS)
    Building project...
    Xcode build...
    Project successfully built.
    Installing on device 3C910396-CEB5-4E0D-A0B3-7CB9A2341193...
    Successfully installed on device with identifier '3C910396-CEB5-4E0D-A0B3-7CB9A2341193'.
    Successfully transferred bundle.js on device 3C910396-CEB5-4E0D-A0B3-7CB9A2341193.
    Successfully transferred package.json on device 3C910396-CEB5-4E0D-A0B3-7CB9A2341193.
    Successfully transferred starter.js on device 3C910396-CEB5-4E0D-A0B3-7CB9A2341193.
    Successfully transferred vendor.js on device 3C910396-CEB5-4E0D-A0B3-7CB9A2341193.
    Restarting application on device 3C910396-CEB5-4E0D-A0B3-7CB9A2341193...
    Successfully synced application com.resideo.exemplar on device 3C910396-CEB5-4E0D-A0B3-7CB9A2341193.
    CONSOLE INFO file:///app/vendor.js:126:36: HMR: Hot Module Replacement Enabled. Waiting for signal.
    CONSOLE INFO file:///app/vendor.js:126:36: HMR: Hot Module Replacement Enabled. Waiting for signal.
    
  2. added this to the 6.0.0 milestone on May 22, 2019
  3. removed this from the 6.0.0 milestone on Jul 16, 2019
  4. changed the title [-]`tns run android --bundle` doesn't exit on webpack compilation error [/-] [+]`tns run android --bundle` doesn't pause on webpack compilation error [/+] on Aug 8, 2019
  5. DimitarTachev commented on Aug 8, 2019

    @DimitarTachev
    Contributor

    @sis0k0

    I've updated the issue title as the CLI should pause on Webpack error instead of exiting the process. The user should be able to fix this error and the CLI should continue with a native build or a LiveSync.

  6. added this to the 6.1.1 milestone on Aug 26, 2019
  7. modified the milestones: 6.1.1, 6.1.2 on Sep 17, 2019
  8. modified the milestones: 6.1.2, 6.2.0 on Sep 26, 2019
  9. Fatme commented on Sep 30, 2019

    @Fatme
    Contributor

    Acceptance criteria:

    • Ensure webpack compilation stops on syntactic/semantic error in angular app whennoEmitOnError is true in tsconfig.json
    • Ensure app crashes runtime on syntactic/semantic error in angular app whennoEmitOnError is false in tsconfig.json
    • Ensure webpack compilation stops on wrong import in javascript or vue app whennoEmitOnErrors is true in webpack.confg.js
    • Ensure app doesn't crash runtime on syntactic error in javascript or vue app whennoEmitOnErrors is false in webpack.confg.js
    • Ensure the new nativescript-dev-webpack plugin is backwards compatible with NativeScript CLI

    known limitation:

  10. endarova commented on Oct 15, 2019

    @endarova
    Contributor
  11. endarova commented on Oct 15, 2019

    @endarova
    Contributor
  12. endarova commented on Oct 16, 2019

    @endarova
    Contributor
  13. Fatme commented on Oct 22, 2019

    @Fatme
    Contributor

    We have the following limitations due to the fact that errors are processed in a different manner from webpack's loaders/plugins:

    • angular doesn't report type errors while webpack is running as they started separate process for checking the errors
    • errors in .html files in angular apps are not reported to webpack
    • errors in .scss files in angular apps are reported to webpack
    • errors in .xml files are not reported to webpack
    • only Module not found error is handled by webpack in js/vue apps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buge2e test neededDescribes that issue requires functional testrunDescribes issues related to run commandseverity: highwebpack

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions