Fallenreaper Fallenreaper - 1 year ago 72
Dart Question

Getting a ScriptCompactor Error, failing to inline import a file

The application I was working on used to work find, I did a pub upgrade, it broke, so i was in the process of reverting. I wiped the cache, I reverted the application, and did a pub get.

I noticed that this error has popped up and has failed to get resolved.

[Error from ScriptCompactor on seg_ui|web/index.html]:
line 7, column 3 of web\index.html: Failed to inline HTML import: Could not find asset polymer_elements|lib/iron_flex_layout/classes/iron_flex_layout.html.
<link rel="import" href="packages/polymer_elements/iron_flex_layout/classes/iron_flex_layout.html">
Build completed with 1 errors.
[web] GET index.html => Could not find asset seg_ui|web/index.html.

I was looking in the file it is referencing, index.html, and saw the line as expected. I tried to comment it out but that didnt work. I removed it to see what would happen and it seems that I get a bunch of warning sabout a bunch of other polymer assets not being found.


[web] GET packages/polymer_elements/iron_resizable_behavior.dart => Could not find asset polymer_elements|lib/iron_resizable_behavior.dart.


[Warning from ImportInliner on seg_ui|web/index.html]:
line 10, column 1 of lib\components\dialog\dialog.html: Failed to inline HTML import: Could not find asset polymer_elements|lib/neon_animation/animations/slide_from_right_animation.html.
<link rel="import" href="../../../../packages/polymer_elements/neon_animation/animations/slide_from_right_animation.html">

Can someone explain why this is occurring and the steps to resolve it? It seems that for some reason, all of my assets are not being correctly understood.

As a side note: When i go to my pubspec, and go get everything is up to date. If i try to repair, it will seem to repair with the exception of a few files having a
HandshakeException: Connection terminated during Handshake.

Answer Source

When pub upgrade breaks the app it is often caused by an invalid cache in the .pub sub-directory of your project.

It is safe to delete this folder. Just run pub get or pub upgrade again afterwards.