-
Notifications
You must be signed in to change notification settings - Fork 9
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
JS parse error (due to bleeding-edge feature use) in <script type="module"> causes spurious error `'import' and 'export' may appear only with 'sourceType: module' #286
Comments
I think you might be right on the parser error. @papandreou this is all pretty long ago in my mind. Could you remind me what the state of JS parsing capabilities of modern modules is in assetgraph? |
I cannot reproduce that? Munter/hyperlink@7ce64a9 Which version of hyperlink are you using? What does |
I think the most likely cause is that there some other problem or syntax error in the parts of the inline script that you omitted ( If that's the case, I do agree that the error message could be better. We could maybe detect errors referring to features that are only supported for modules in the fallback, and then emit the original error in that case. |
I think you're right! I came up with this minimal test case:
The I suppose the behavior I would like is, if Either way, thanks for the help! |
'import' and 'export' may appear only with 'sourceType: module'
in <script type="module">…e features Munter/netlify-plugin-checklinks#286 (comment) (cherry picked from commit 5174cd0)
Fixed in assetgraph 6.3.0 by reporting the original error (via assetgraph/assetgraph@918f2f9) which is in range. Try updating 🤗 |
Thanks for this plugin! It has caught quite a few genuine errors, but here's one that I think is spurious.
The essence of the page is:
This gives me the error:
I'm guessing your JS parser needs to know about the
type
of the<script>
.The text was updated successfully, but these errors were encountered: