question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

data.json is not generated correctly

See original GitHub issue

🐞 Bug report

Description

After update scully and ng-lib to version 1.1.1 the data.json contains the following string:

")[1].split("

While the index.html in state script contains the correct information and renders the page properly, navigating to the other pages in the running app breaks because it can’t get the data from the state.

🔬 Minimal Reproduction

  1. Have an application that utilizes TransferStateService.
  2. Build the app and run scully.
  3. Go to dist/static/data.json

I tried it in 2 different projects and it has the same issue.

💻Your Environment

Angular Version:




Angular CLI: 11.1.4
Node: 14.16.0
OS: linux x64

Angular: 11.1.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1101.4
@angular-devkit/build-angular   0.1101.4
@angular-devkit/core            11.1.4
@angular-devkit/schematics      11.1.4
@angular/cli                    11.1.4
@schematics/angular             11.1.4
@schematics/update              0.1101.4
rxjs                            6.6.3
typescript                      4.1.3

Scully Version:




"@scullyio/ng-lib": "^1.1.1",
"@scullyio/scully": "^1.1.1",

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
BlindDespaircommented, Apr 24, 2021

@SanderElias I check the configs and what helps is switching off the minifyJS option off. So here is the difference it produces: minifyJS: false,: image minifyJS: true,: image and this part is exactly what gets parsed by scully, I guess you can tell why: image So I am gonna turn it off for now, but I think this has to be solved by default somehow, from what I see, the version with minified inline JS is only 17 bytes smaller which I can easily let go of. I suggest we open an issue on scully-plugin-minify-html and suggest to make minimizeJS: false as a default, but if you have a better idea how this can be hanlded better that would interesting to know.

1reaction
SanderEliascommented, Apr 15, 2021

@BlindDespair This problem is fixed already. It’s happening if you have template strings inside the JSON you’re trying to embed. I’ll check if we did release the fix tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON.stringify does not generate correct json - Stack Overflow
$.ajax({ url: "SaladEntry/FillData", type: "POST", cache: false, contentType: "application/json;", data: paramSerialized, success: function ( ...
Read more >
5 SQL/JSON Conditions IS JSON and IS NOT JSON
SQL/JSON conditions is json and is not json are complementary. They test whether their argument is syntactically correct, that is, well-formed, JSON data....
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >
Solve common issues with JSON in SQL Server
Answer. If you specify the WITHOUT_ARRAY_WRAPPER option in the inner FOR JSON , the resulting JSON text is not necessarily valid JSON. Therefore ......
Read more >
How to Fix “The Response Is Not a Valid JSON ... - iThemes
Wrongly configured WordPress Address and Site Address settings will interrupt the correct work of REST API, leading to “The response is not a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found