svelte-template-hot icon indicating copy to clipboard operation
svelte-template-hot copied to clipboard

TypeError: Cannot read property 'length' of undefined w/ @rollup/plugin-commonjs v16

Open frederikhors opened this issue 3 years ago • 7 comments

From "@rollup/plugin-commonjs": "16.0.0" this is the error:

[Nollup] Listening on http://localhost:5000
TypeError: Cannot read property 'length' of undefined
    at new MagicString (C:\svelte\node_modules\magic-string\dist\magic-string.cjs.js:354:34)
    at module.exports (C:\svelte\node_modules\nollup\lib\impl\ImportExportResolver.js:318:21)
    at compileModule (C:\svelte\node_modules\nollup\lib\impl\NollupCompiler.js:59:30)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async compileInputTarget (C:\svelte\node_modules\nollup\lib\impl\NollupCompiler.js:138:5)
    at async Object.compile (C:\svelte\node_modules\nollup\lib\impl\NollupCompiler.js:211:31)
    at async generateImpl (C:\svelte\node_modules\nollup\lib\index.js:13:21)

Reproduction here: https://github.com/frederikhors/svelte-template-hot/tree/update-commonjs-to-16

frederikhors avatar Oct 27 '20 09:10 frederikhors

OK thanks (for all your help around here, it's really appreciated & valuable). I'll investigate that.

rixo avatar Oct 27 '20 11:10 rixo

Confirmed on my side. This is between Nollup and @rollup/plugin-commonjs. I think the issue should be reported at Nollup, 'cause he's probably in the best position to understand what's going on.

I'm pinning @rollup/plugin-commonjs@15 in the template for now.

rixo avatar Nov 27 '20 15:11 rixo

Are you opening the issue on nollup describing what you think? Do you want?

frederikhors avatar Nov 27 '20 15:11 frederikhors

I'll do it eventually, but I'm swamped these days :sweat: Go for it if you can ;)

rixo avatar Nov 27 '20 15:11 rixo

Done.

frederikhors avatar Nov 27 '20 15:11 frederikhors

Fixed in nollup 0.14.0.

frederikhors avatar Nov 29 '20 22:11 frederikhors

We should probably bump to last versions of Nollup and the commonjs plugin in the template now that this is fixed, before closing this issue.

rixo avatar Nov 30 '20 11:11 rixo