Inlined functions seem to fail vite HTML parsing #20

Open
opened 2024-05-25 19:26:37 +00:00 by xrdawson · 0 comments
xrdawson commented 2024-05-25 19:26:37 +00:00 (Migrated from extrastatic.dev)

This line causes a crash: on:click={ () => generateEmbedding(example, exampleResult) }.

The fix is to replace () => generateEmbedding(example, exampleResult) with a function name only, then the > does not confuse the parser.

(base) chrisdawson@Chriss-MacBook-Air svekyll-blog 4 % yarn build
yarn run v1.22.19
warning package.json: No license field
$ svekyll-cli build && svekyll-cli finalize
  NOTICE:  No blog roll found, skipping Error: ENOENT: no such file or directory, open './blogs.json'
  NOTICE:  Unable to find local index.html, loading from node modules
  NOTICE:  Unable to find local src/Index.svelte, loading from node modules
  NOTICE:  Unable to find local src/Page.svelte, loading from node modules
  NOTICE:  Unable to find local src/index.html, loading from node modules
  NOTICE:  Unable to find local user.css, loading from node modules
  NOTICE:  Unable to find local svekyll/svekyll.css, loading from node modules
5/25/2024, 3:25:00 PM  Found 2 candidates
5/25/2024, 3:25:00 PM  Generated files 1
5/25/2024, 3:25:00 PM  VIEW_SOURCE enabled
5/25/2024, 3:25:00 PM  Paginations length 1
5/25/2024, 3:25:00 PM  Generating tag roots
5/25/2024, 3:25:00 PM  Generated tag roots 3
5/25/2024, 3:25:00 PM  Copying static files
5/25/2024, 3:25:00 PM  No static directory found
file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:37523
    throw new Error(`Unable to parse HTML; ${parseError.message}\n` +
          ^

Error: Unable to parse HTML; parse5 error code missing-attribute-value
 at /Users/chrisdawson/Downloads/svekyll-blog 4/root/page/2024-04-29-distance-sean-shawn/index.html:27:20
25 |  <button 
26 |      disabled={!example}
27 |      on:click={ () => generateEmbedding(example, exampleResult) } 
   |                     ^
28 |      class="btn">
29 |  {#if example}
    at handleParseError (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:37523:11)
    at Parser.onParseError (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:37449:13)
    at Tokenizer._err (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:1125:89)
    at Tokenizer._stateBeforeAttributeValue (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:2587:22)
    at Tokenizer._callState (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:1620:22)
    at Tokenizer._runParsingLoop (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:1149:22)
    at Tokenizer.write (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/
This line causes a crash: `on:click={ () => generateEmbedding(example, exampleResult) }`. The fix is to replace `() => generateEmbedding(example, exampleResult)` with a function name only, then the `>` does not confuse the parser. ``` (base) chrisdawson@Chriss-MacBook-Air svekyll-blog 4 % yarn build yarn run v1.22.19 warning package.json: No license field $ svekyll-cli build && svekyll-cli finalize NOTICE: No blog roll found, skipping Error: ENOENT: no such file or directory, open './blogs.json' NOTICE: Unable to find local index.html, loading from node modules NOTICE: Unable to find local src/Index.svelte, loading from node modules NOTICE: Unable to find local src/Page.svelte, loading from node modules NOTICE: Unable to find local src/index.html, loading from node modules NOTICE: Unable to find local user.css, loading from node modules NOTICE: Unable to find local svekyll/svekyll.css, loading from node modules 5/25/2024, 3:25:00 PM Found 2 candidates 5/25/2024, 3:25:00 PM Generated files 1 5/25/2024, 3:25:00 PM VIEW_SOURCE enabled 5/25/2024, 3:25:00 PM Paginations length 1 5/25/2024, 3:25:00 PM Generating tag roots 5/25/2024, 3:25:00 PM Generated tag roots 3 5/25/2024, 3:25:00 PM Copying static files 5/25/2024, 3:25:00 PM No static directory found file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:37523 throw new Error(`Unable to parse HTML; ${parseError.message}\n` + ^ Error: Unable to parse HTML; parse5 error code missing-attribute-value at /Users/chrisdawson/Downloads/svekyll-blog 4/root/page/2024-04-29-distance-sean-shawn/index.html:27:20 25 | <button 26 | disabled={!example} 27 | on:click={ () => generateEmbedding(example, exampleResult) } | ^ 28 | class="btn"> 29 | {#if example} at handleParseError (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:37523:11) at Parser.onParseError (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:37449:13) at Tokenizer._err (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:1125:89) at Tokenizer._stateBeforeAttributeValue (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:2587:22) at Tokenizer._callState (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:1620:22) at Tokenizer._runParsingLoop (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js:1149:22) at Tokenizer.write (file:///Users/chrisdawson/Downloads/svekyll-blog%204/node_modules/vite/dist/node/ ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
svekyll/svekyll-cli#20
No description provided.