Not implemented undefined (List of Nodes in handle)
See original GitHub issueDescribe the bug
Using svelte 3.42.4, building my project using snowpack fails with the following error:
[08:01:56] [snowpack] ! building files...
[08:02:01] [snowpack] Build Result Error: There was a problem with a file build result.
[08:02:01] [snowpack] Not implemented undefined
[08:02:01] [snowpack] Error: Not implemented undefined
at handle (/Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6178:10)
at /Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6414:19
at Array.map (<anonymous>)
at handle_body (/Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6413:22)
at /Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6495:8
at scoped_fn (/Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6382:11)
at handle (/Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6181:18)
at IfStatement (/Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6532:8)
at handle (/Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6181:18)
at /Users/cpennington/personal/dicedornot/node_modules/svelte/compiler.js:6414:19
The error is happening in this function in compiler.js
/**
* @param {Node} node
* @param {State} state
* @returns {Chunk[]}
*/
function handle(node, state) {
const handler = handlers[node.type];
if (!handler) {
throw new Error(`Not implemented ${node.type}`);
}
const result = handler(node, state);
if (node.leadingComments) {
result.unshift(c(node.leadingComments.map(comment => comment.type === 'Block'
? `/*${comment.value}*/${/** @type {any} */ (comment).has_trailing_newline ? `\n${state.indent}` : ` `}`
: `//${comment.value}${/** @type {any} */ (comment).has_trailing_newline ? `\n${state.indent}` : ` `}`).join(``)));
}
if (node.trailingComments) {
state.comments.push(node.trailingComments[0]); // there is only ever one
}
return result;
}
Some debugging suggests that node
being passed into this function is in fact a list of nodes, instead.
The same build completes with svelte 3.35.0.
Reproduction
Check out https://github.com/cpennington/dicedornot/tree/package-upgrade
Run
npm install
npm build
Logs
No response
System Info
npx: installed 1 in 1.857s
System:
OS: macOS 11.4
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 399.40 MB / 16.00 GB
Shell: 3.2.1 - /usr/local/bin/fish
Binaries:
Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.3/bin/npm
Browsers:
Chrome: 93.0.4577.63
Firefox: 91.0
Safari: 14.1.1
npmPackages:
snowpack: ^3.8.8 => 3.8.8
svelte: ^3.42.4 => 3.42.4
Severity
blocking an upgrade
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
[vite] Internal server error: Not implemented undefined with ...
I am getting the following error when I try to load some packages. I only get the error when I have the babel...
Read more >node.js displays "undefined" on the console - Stack Overflow
So node used to print undefined return type for the called function. function emitEvent(eventname){ eventEmitter.
Read more >Best Practices for Node.js Error-handling - Toptal
A good example is to try to read a property of “undefined.” To fix the issue, the code has to be changed. That...
Read more >How to Fix the HTTP 501 Not Implemented Error on Your Site
The HTTP 501 Not Implemented status code indicates that the server does not support the functionality required to fulfill the request.
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Bare specifier resolutions are handled by the Node.js module resolution ... Using require to load an ES module is not supported because ES...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This seems to be caused by this invalid cast from
Node[]
->Node
in Component.ts.estree-walker
doesn’t provide a way to replace a single node with multiple as far as I can see.Update- I just solved my issue. It may work for you.
Clued in by the code-red part that handled For loops, I’ve verified that the following code causes this error
whereas the following solves the problem.
The latter seems to be the appropriate form but ideally the for (var … ) case would be handled informatively by code-red.