New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '_walk' of null #928

Closed
ariovistus opened this Issue Oct 9, 2018 · 14 comments

Comments

Projects
None yet
4 participants
@ariovistus

ariovistus commented Oct 9, 2018

I'm submitting a bug report

  • Library Version:
    0.32.0

Please tell us about your environment:

  • Operating System:
    Linux (fedora)

  • Node Version:
    8.12.0

  • NPM Version:
    6.4.1

  • Browser:
    all

  • Language:
    all

  • Loader/bundler:
    RequireJS

Current behavior:
I managed to build something that uglifyjs pukes on:
https://travis-ci.org/frc3223/stats/builds/438988302

turning off minification is a workaround, but I'd kind of like to not have to do that
code is here: https://github.com/frc3223/stats/tree/uglibug

  • What is the expected behavior?
    app can be built with minification enabled

  • What is the motivation / use case for changing the behavior?

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

Your version is too old.
v0.34.0 has replaced uglify with terser for modern JS syntax compatibility.

If you upgrade to today's release v1.0.0-beta.1, make sure you follow the migration guide https://aurelia.io/blog/2018/10/08/release-aurelia-cli-with-auto-tracing-bundler

@vermilion

This comment has been minimized.

vermilion commented Oct 9, 2018

@huochunpeng, faced same issue while building with prod-minify config @v1.0.0-beta.1
Everything worked fine using v0.35

ERROR [Bundle] Failed to write the bundle
INFO [Bundle] TypeError: Cannot read property '_walk' of null
...[path]\node_modules\async-done\index.js:18
    throw err;
    ^

My config in aurelia.json

    "options": {
      "minify": {
        "prod": {
          "mangle": {
            "keep_fnames": true,
            "toplevel": true
          }
        },
        "stage": {}
      },
      "sourcemaps": "dev & stage"
    },
@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

@vermilion are you using async-done, is it the one causing trouble? I could not get async-done working in browser, my app fails.
But the bundling is ok, even with minify in prod plus your minify config.

@vermilion

This comment has been minimized.

vermilion commented Oct 9, 2018

This is my new auto-tracing log. I don't use it explicitly, maybe some of deps are using it... How could I find such?

INFO [Bundle] Manually adding package: 2.3.0      aurelia-bootstrapper
INFO [Bundle] Manually adding package: 1.0.4      aurelia-loader-default
INFO [Bundle] Manually adding package: 1.8.0      aurelia-pal-browser
INFO [Bundle] Manually adding package: 2.0.15     text
INFO [Bundler] Tracing files ...
INFO [Bundler] Auto tracing package: 1.1.4      au-bootstrap
INFO [Bundler] Auto tracing package: 1.0.0      au-configuration
INFO [Bundler] Auto tracing package: 1.3.3      au-container
INFO [Bundler] Auto tracing package: 1.1.8      au-core
INFO [Bundler] Auto tracing package: 1.0.1      au-dropdown
INFO [Bundler] Auto tracing package: 1.0.2      au-files
INFO [Bundler] Auto tracing package: 2.1.3      au-grid
INFO [Bundler] Auto tracing package: 1.0.0      au-loader
INFO [Bundler] Auto tracing package: 1.0.2      au-modals
INFO [Bundler] Auto tracing package: 1.0.0      au-notify
INFO [Bundler] Auto tracing package: 1.4.1      au-request-builder
INFO [Bundler] Auto tracing package: 2.0.5      au-select
INFO [Bundler] Auto tracing package: 2.2.3      au-sidebar-control
INFO [Bundler] Auto tracing package: 1.0.3      au-websocket
INFO [Bundler] Auto tracing package: 1.4.1      aurelia-dependency-injection
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-dialog
INFO [Bundler] Auto tracing package: 1.0.1      aurelia-event-aggregator
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-framework
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-history-browser
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-loader
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-logging-console
INFO [Bundler] Auto tracing package: 1.0.4      aurelia-metadata
INFO [Bundler] Auto tracing package: 1.8.0      aurelia-pal
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-polyfills
INFO [Bundler] Auto tracing package: 1.6.3      aurelia-router
INFO [Bundler] Auto tracing package: 1.4.3      aurelia-templating-binding
INFO [Bundler] Auto tracing package: 1.7.1      aurelia-templating-resources
INFO [Bundler] Auto tracing package: 1.3.3      aurelia-templating-router
INFO [Bundler] Auto tracing package: 1.0.0-beta.3.3.2 aurelia-ui-virtualization
INFO [Bundler] Auto tracing package: 1.2.3      aurelia-validation
INFO [Bundler] Auto tracing package: 2.1.5      aurelia-binding
INFO [Bundler] Auto tracing package: 1.1.0      aurelia-history
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-http-client
INFO [Bundler] Auto tracing package: 1.5.0      aurelia-logging
INFO [Bundler] Auto tracing package: 1.1.1      aurelia-path
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-route-recognizer
INFO [Bundler] Auto tracing package: 1.3.1      aurelia-task-queue
INFO [Bundler] Auto tracing package: 1.10.0     aurelia-templating
INFO [Bundler] Auto tracing package: 2.22.2     moment
INFO [Bundler] Auto tracing package: 1.4.5      tether
INFO [Bundler] Auto tracing package: 1.5.2      velocity-animate
INFO [Bundle] Writing app-bundle.js...
INFO [Bundle] Writing vendor-bundle.js...
Application Available At: http://localhost:9000
BrowserSync Available At: http://localhost:3001
@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

Looks like this is related terser-js/terser#120

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

@vermillion nvm, async-done is deep dep of cli itself, not your frontend.

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

@vermillion can you share your full error log? Must be some package triggered that terser bug.

@vermilion

This comment has been minimized.

vermilion commented Oct 9, 2018

Here it is - prod log

running command> au run --watch --env prod
INFO [Bundle] Manually adding package: 2.3.0      aurelia-bootstrapper
INFO [Bundle] Manually adding package: 1.0.4      aurelia-loader-default
INFO [Bundle] Manually adding package: 1.8.0      aurelia-pal-browser
INFO [Bundle] Manually adding package: 2.0.15     text
INFO [Bundler] Tracing files ...
INFO [Bundler] Auto tracing package: 1.1.4      au-bootstrap
INFO [Bundler] Auto tracing package: 1.0.0      au-configuration
INFO [Bundler] Auto tracing package: 1.3.3      au-container
INFO [Bundler] Auto tracing package: 1.1.8      au-core
INFO [Bundler] Auto tracing package: 1.0.1      au-dropdown
INFO [Bundler] Auto tracing package: 1.0.2      au-files
INFO [Bundler] Auto tracing package: 2.1.3      au-grid
INFO [Bundler] Auto tracing package: 1.0.0      au-loader
INFO [Bundler] Auto tracing package: 1.0.2      au-modals
INFO [Bundler] Auto tracing package: 1.0.0      au-notify
INFO [Bundler] Auto tracing package: 1.4.1      au-request-builder
INFO [Bundler] Auto tracing package: 2.0.5      au-select
INFO [Bundler] Auto tracing package: 2.2.3      au-sidebar-control
INFO [Bundler] Auto tracing package: 1.0.3      au-websocket
INFO [Bundler] Auto tracing package: 1.4.1      aurelia-dependency-injection
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-dialog
INFO [Bundler] Auto tracing package: 1.0.1      aurelia-event-aggregator
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-framework
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-history-browser
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-loader
INFO [Bundler] Auto tracing package: 1.0.0      aurelia-logging-console
INFO [Bundler] Auto tracing package: 1.0.4      aurelia-metadata
INFO [Bundler] Auto tracing package: 1.8.0      aurelia-pal
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-polyfills
INFO [Bundler] Auto tracing package: 1.6.3      aurelia-router
INFO [Bundler] Auto tracing package: 1.4.3      aurelia-templating-binding
INFO [Bundler] Auto tracing package: 1.7.1      aurelia-templating-resources
INFO [Bundler] Auto tracing package: 1.3.3      aurelia-templating-router
INFO [Bundler] Auto tracing package: 1.0.0-beta.3.3.2 aurelia-ui-virtualization
INFO [Bundler] Auto tracing package: 1.2.3      aurelia-validation
INFO [Bundler] Auto tracing package: 2.1.5      aurelia-binding
INFO [Bundler] Auto tracing package: 1.1.0      aurelia-history
INFO [Bundler] Auto tracing package: 1.3.0      aurelia-http-client
INFO [Bundler] Auto tracing package: 1.5.0      aurelia-logging
INFO [Bundler] Auto tracing package: 1.1.1      aurelia-path
INFO [Bundler] Auto tracing package: 1.2.0      aurelia-route-recognizer
INFO [Bundler] Auto tracing package: 1.3.1      aurelia-task-queue
INFO [Bundler] Auto tracing package: 1.10.0     aurelia-templating
INFO [Bundler] Auto tracing package: 2.22.2     moment
INFO [Bundler] Auto tracing package: 1.4.5      tether
INFO [Bundler] Auto tracing package: 1.5.2      velocity-animate
INFO [Bundle] Writing app-bundle.js...
INFO [Bundle] Writing vendor-bundle.js...
ERROR [Bundle] Failed to write the bundle
INFO [Bundle] TypeError: Cannot read property '_walk' of null
C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:18
    throw err;
    ^

Error: Unhandled "error" event. ([object Object])
    at Gulp.emit (events.js:186:19)
    at Object.error (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\undertaker\lib\helpers\createExtensions.js:61:10)
    at handler (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\now-and-later\lib\mapSeries.js:43:14)
    at f (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\once\once.js:25:25)
    at f (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\once\once.js:25:25)
    at tryCatch (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:24:15)
    at done (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:40:12)
    at onError (C:\work\Xerox.Infolio\Xerox.Infolio-rebase\Infolio\Infolio.Core.Service\InfolioWebAdmin\node_modules\async-done\index.js:51:5)
    at <anonymous>

Watching build tasks has finished.

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

@vermilion can you try this temporary fix suggested in that terser issue?

"options": {
      "minify": {
        "prod": {
          "mangle": {
            "keep_fnames": true,
            "toplevel": true
          },
          "compress": {
           "collapse_vars": false
          }
        },
        "stage": {}
      },
@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

Seems like an issue affected the whole uglify family :-)
HubSpot/tether#291

@vermilion

This comment has been minimized.

vermilion commented Oct 9, 2018

@huochunpeng, your workaround works fine! Now waiting for an official bugfix :)

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 9, 2018

@ariovistus I guess you only need the compress config patch.

"options": {
      "minify": {
        "prod": {
          "compress": {
           "collapse_vars": false
          }
        },
        "stage": {
          "compress": {
           "collapse_vars": false
          }
        }
      },
@Alexander-Taran

This comment has been minimized.

Member

Alexander-Taran commented Oct 14, 2018

It is "moment"
it does not like to be minified.

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 14, 2018

It seems like a nasty bug that uglify/terser guys have yet to fix. This is a combination of compress options, turn off any one of them could bypass the issue.

I think we can ship cli with a default compress options patch. I will do a PR.

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 14, 2018

fix(bundler): bypass a nasty terser compress bug by using fast-minify…
…-mode

The original code supposed to use fast-minify-mode, but somehow it was not. This fix turns on fast-minify-mode, that disables compress. The resulting minified size is surprisingly almost as small as normal mode, but it uses uses a quarter of the time. https://github.com/terser-js/terser#terser-fast-minify-mode

closes aurelia#928

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 14, 2018

fix(bundler): bypass a nasty terser compress bug by using fast-minify…
…-mode

The original code supposed to use fast-minify-mode, but somehow it was not. This fix turns on fast-minify-mode, that disables compress. The resulting minified size is surprisingly almost as small as normal mode, but it uses uses a quarter of the time. https://github.com/terser-js/terser#terser-fast-minify-mode

closes aurelia#928

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 14, 2018

fix(bundler): bypass a nasty terser compress bug by using fast-minify…
…-mode

The original code supposed to use fast-minify-mode, but somehow it did not. This fix turns on fast-minify-mode, that disables compress. The resulting minified size is surprisingly almost as small as normal mode, but it only uses a quarter of the time. https://github.com/terser-js/terser#terser-fast-minify-mode

closes aurelia#928

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 14, 2018

fix(bundler): bypass a nasty terser compress bug by using fast-minify…
…-mode

The original code supposed to use fast-minify-mode, but somehow it did not. This fix turns on fast-minify-mode, that disables compress. The resulting minified size is surprisingly almost as small as normal mode, but it only uses a quarter of the time. https://github.com/terser-js/terser#terser-fast-minify-mode

closes aurelia#928
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment