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

Can't parser JSX #176

Closed
fisker opened this issue Feb 8, 2021 · 7 comments
Closed

Can't parser JSX #176

fisker opened this issue Feb 8, 2021 · 7 comments

Comments

@fisker
Copy link
Collaborator

fisker commented Feb 8, 2021

Self closing can parse

> require('meriyah').parse('var  a = <div/>', {jsx: true}).body[0].declarations[0].init
{
  type: 'JSXElement',
  children: [],
  openingElement: {
    type: 'JSXOpeningElement',
    name: { type: 'JSXIdentifier', name: 'div' },
    attributes: [],
    selfClosing: true
  },
  closingElement: null
}

but

require('meriyah').parse('var  a = <div></div>', {jsx: true}).body[0].declarations[0].init
Uncaught [ParseError [SyntaxError]: [1:20]: Unexpected token
] {
  index: 20,
  line: 1,
  column: 20,
  description: '[1:20]: Unexpected token',
  loc: { line: 1, column: 20 }
}

Did I do something wrong?

@3cp
Copy link
Member

3cp commented Feb 9, 2021

It seems the latest 4.1.0 shipped with wrong dist files. I think this is the second time we got wrong dist files (maybe only the second time we noticed). I will make sure to add step to clean up tsc cache before bundle.

@3cp
Copy link
Member

3cp commented Feb 9, 2021

It's probably from rollup-plugin-typescript2 ezolenko/rollup-plugin-typescript2#262

I will add clean: true.

@3cp 3cp closed this as completed in d6462be Feb 9, 2021
@3cp
Copy link
Member

3cp commented Feb 9, 2021

I will release a patch tonight when I got back to home mac.

@3cp
Copy link
Member

3cp commented Feb 9, 2021

v4.1.1 fixed the issue.

I think rollup-plugin-typescript2 has some bug on invalidating cache. One ts file may be affected by multiple ts files (especially those only provide typing, but yield no js file).

@fisker
Copy link
Collaborator Author

fisker commented Feb 9, 2021

Thanks!

@agilgur5
Copy link

agilgur5 commented Jun 8, 2022

Hi 👋 . I help maintain rollup-plugin-typescript2 nowadays and was looking into old issues and saw this was referenced from ezolenko/rollup-plugin-typescript2#262 .

I haven't been able to reproduce that specific issue and don't think it's related to this problem. If you believe this has to do with type-only files per your previous comment

I think rollup-plugin-typescript2 has some bug on invalidating cache. One ts file may be affected by multiple ts files (especially those only provide typing, but yield no js file).

then it could very well be due to ezolenko/rollup-plugin-typescript2#7 instead, which indeed points out that the cache's module graph may not correctly set dependencies ("One ts file may be affected by multiple ts files") between modules when it comes to type-only files

Just thought I'd correct that for posterity and future reference, as well as give a possible root cause based on the comments here.

@agilgur5
Copy link

Wanted to update here that ezolenko/rollup-plugin-typescript2#7 has been fixed by ezolenko/rollup-plugin-typescript2#406 and released in rpt2 0.34.0 🙂

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

No branches or pull requests

3 participants