Skip to content
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

Parcel (the transformer?) does not recover after an error in an imported AS file #8

Closed
dipdowel opened this issue Jun 1, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@dipdowel
Copy link
Owner

dipdowel commented Jun 1, 2023

Summary

Either Parcel or the transformer does not recover after an error occurs in an AssemblyScript file imported in index.as.ts

Steps to reproduce

  1. Clone the project template
  2. Change directory to assemblyscript-parcel-template
  3. yarn or npm install
  4. yarn start or npm run start
  5. Open http://localhost:1234/ in your browser
  6. Open assembly/index.as.ts in your IDE
  7. After line const result = add16bit(<i16>a, <i16>b); insert const t: i32;
  8. Save and observer the error in the terminal and in your browser console
  9. Remove line const t: i32; from assembly/index.as.ts and save the file.

State at this point

Parcel should successfully recompile your AS code and the error message should disappear form the terminal and from the browser console.

  1. Open assembly/helpers/add-16bit.ts in your IDE
  2. Before line return a + b; insert const t: i32;
  3. Save and observer the error in the terminal and in your browser console
  4. Remove line const t: i32; from assembly/helpers/add-16bit.ts and save the file.

Expected result

Parcel should successfully recompile your AS code and the error message should disappear form the terminal and from the browser console.

Actual result

Parcel does not seem to detect the change in assembly/helpers/add-16bit.ts, the error message remains in the terminal and in the browser console. Please see the screenshot below:

01-06-2023_error-not-recovered

A work-around

If you then make any change in index.as.ts and save it, the project will be recompiled and reloaded as expected.

@dipdowel dipdowel added the bug Something isn't working label Jun 1, 2023
@mischnic
Copy link
Contributor

mischnic commented Jun 2, 2023

Currently, you do:

  • Run the ASC compiler
  • if there's an error, throw
  • add the file invalidations, call asset.setCode, ...

Instead, you need to

  • Run the ASC compiler
  • add the file invalidations
  • if there's an error, throw
  • call asset.setCode, ...

E.g. https://github.com/mischnic/parcel-transformer-assemblyscript-codument/commit/420cd42c1c63e105bd4c6ef18902e856b9cc08e3

dipdowel added a commit that referenced this issue Jun 2, 2023
…n an imported AS file.

+-------------------------------+
| This solution in its entirety |
|   was provided by @mischnic   |
+-------------------------------+

- Dependency versions bumped
- The fix
- Refactoring + code quality improvements
dipdowel added a commit that referenced this issue Jun 2, 2023
…n-imported-file_from-@mischnic

Issue #8, Parcel (the transformer?) does not recover after an error in an imported AS file.

+------------------------------------------------
|   This solution in its entirety
|   was provided by @mischnic
+------------------------------------------------

- Dependency versions bumped
- The fix
- Refactoring + code quality improvements
@dipdowel
Copy link
Owner Author

dipdowel commented Jun 2, 2023

Currently, you do:

E.g. mischnic@420cd42

Hey @mischnic, thanks a lot for the suggested solution, it did the trick! Also, thank you so much for improving the quality of the code that surrounded your changes.
Here's the merged PR with your suggestion: #9

@dipdowel dipdowel closed this as completed Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants