Skip to content

fix(plugin-initial-state)/prettier app.ts parse error#902

Closed
stormslowly wants to merge 6 commits intomasterfrom
fix/app_parse_error
Closed

fix(plugin-initial-state)/prettier app.ts parse error#902
stormslowly wants to merge 6 commits intomasterfrom
fix/app_parse_error

Conversation

@stormslowly
Copy link
Copy Markdown
Member

after

ERROR parse /Users/example/git/problem/umi3-project/src/app.ts Failed
   5 |   if(true){
   6 |     console.log('yes')
>  7 |   },
     |    ^
   8 |   console.trace('xxxxxxxxxxxxytyyyyyyyyy')
   9 | }
  10 |
Unexpected token (7:3)
SyntaxError: Unexpected token (7:3)
    at Object._raise (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:28077:17)
    at Object.raiseWithData (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:28070:17)
    at Object.raise (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:28031:17)
    at Object.unexpected (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:37201:16)
    at Object.parseExprAtom (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38603:20)
    at Object.parseExprSubscripts (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38174:23)
    at Object.parseUpdate (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38154:21)
    at Object.parseMaybeUnary (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:38132:23)
    at Object.parseMaybeUnary (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:34863:20)
    at Object.parseExprOps (/Users/example/git/plugins/node_modules/@umijs/deps/compiled/babel/bundle.js:37989:23)

before

Unexpected token (7:3)
SyntaxError: Unexpected token (7:3)
    at instantiate (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:26189:32)
    at constructor (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:26476:12)
    at Object.raise (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:29456:19)
    at Object.unexpected (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:29494:16)
    at Object.parseExprAtom (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:39240:22)
    at Object.parseExprSubscripts (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38765:23)
    at Object.parseUpdate (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38744:21)
    at Object.parseMaybeUnary (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38715:23)
    at Object.parseMaybeUnary (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:36917:20)
    at Object.parseMaybeUnaryOrPrivate (/Users/example/git/umi3/packages/deps/compiled/babel/bundle.js:38509:61)

@stormslowly stormslowly changed the title fix(plugin-initial-state)/prettier app.ts parse error [wip] fix(plugin-initial-state)/prettier app.ts parse error Sep 7, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 7, 2022

Codecov Report

❌ Patch coverage is 26.82927% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.92%. Comparing base (69bcf45) to head (3d3028e).
⚠️ Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
packages/plugin-qiankun/src/master/index.ts 0.00% 11 Missing ⚠️
packages/plugin-model/src/utils/index.ts 44.44% 10 Missing ⚠️
packages/plugin-initial-state/src/index.ts 30.00% 7 Missing ⚠️
packages/plugin-qiankun/src/slave/index.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #902      +/-   ##
==========================================
- Coverage   44.41%   43.92%   -0.50%     
==========================================
  Files          67       67              
  Lines        1727     1760      +33     
  Branches      474      478       +4     
==========================================
+ Hits          767      773       +6     
- Misses        951      978      +27     
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

const enable = shouldPluginEnable(entryFile);
let enable = false;

try {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

封装成一个公共方法?比如 tryCatchFriendlyParseError,捕获 & codeFrame 逻辑写里面,外部传个函数进去执行

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在各个包都是独立的,提取还是重复代码就没提取了。

@stormslowly stormslowly changed the title [wip] fix(plugin-initial-state)/prettier app.ts parse error fix(plugin-initial-state)/prettier app.ts parse error Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants