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.

Sourcemaps appear to be broken when uglify/--prod task is used. #1235

Open
@phildotdev

Description

@phildotdev

Short description of the problem:

For info, the below behaviour of generating production sourcemaps worked correctly in v1.3.12 so I feel like this is a potential regression or bug.

When setting ionic_generate_source_map to true and running ionic build --prod, the sourcemaps produced seem to be broken as they are significantly different when compared to ionic build based sourcemaps with several base64 chunks and random blocks of code seemingly in the wrong position. When checking the sourcemaps with Raygun The same part of the sourcemap always returns when querying different lines/columns. The sourceMappingURL is also missing on main.js & vendor.js

I believe the problem occurs when the uglifyjs task is ran as it doesn't occur on ionic build for example. I tried to provide my own config based on a modified default config to uglifyjs with sourcemaps set to true to no effect.

Also, when setting ionic_generate_source_map to true, vendor.js.map isn't copied over to the sourcemaps folder.

The reason for needing sourcemaps based on --prod code is for error tracking.

I've spent a few hours looking at the app-scripts workflow but couldn't quite work out where the uglifyjs sourcemap options were getting added but I'd be happy to look more into this if I could get some guidance and help as to where to look.

There are some similar-ish tickets to my one but they refer to different aspects of sourcemaps, eg the mappingurl being an absolute path, not completely missing so I don't think this is a duplicate.

Thanks.

What behavior are you expecting?

To summarise, I'd expect when running the build task with --prod flag:

  1. The //# sourceMappingURL=main.js.map to be present in main.js,
  2. The //# sourceMappingURL=vendor.js.map to be present in vendor.js,
  3. vendor.js.map should be copied into the .sourcemaps directory,
  4. The sourcemaps to be generating correctly.

Steps to reproduce:

  1. Set ionic_generate_source_map to true in package.json
  2. Run ionic build and save sourcemaps somewhere,
  3. Run ionic build --prod and compare sourcemaps.

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

Metadata

Metadata

Assignees

No one assigned

    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