Skip to content

Confusing error message "TypeError: Cannot read property 'start' of undefined" with invalid css #3801

@kjk

Description

@kjk

By mistake I had this invalid css in my component:

<style>
  .no-wrap {
    word-wrap: ;
  }
</style>

With latest 3.12.1 I get the following compilation error:

Running: 'node_modules/.bin/rollup -c -w'
rollup v1.25.0
bundles svelte/main.js → www/gen/bundle.js...
[!] (plugin svelte) TypeError: Cannot read property 'start' of undefined
svelte/GistEditor.svelte
TypeError: Cannot read property 'start' of undefined
    at Declaration$1.minify (/Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/css/Stylesheet.ts:148:21)
    at /Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/css/Stylesheet.ts:32:15
    at Array.forEach (<anonymous>)
    at minify_declarations (/Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/css/Stylesheet.ts:27:15)
    at Rule$1.minify (/Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/css/Stylesheet.ts:92:7)
    at /Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/css/Stylesheet.ts:408:11
    at Array.forEach (<anonymous>)
    at Stylesheet.render (/Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/css/Stylesheet.ts:405:17)
    at dom (/Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/render_dom/index.ts:33:35)
    at render_dom (/Users/kjk/src/codeeval/node_modules/svelte/src/compiler/compile/index.ts:86:6)

I understand this is invalid cs but it's hard to figure out what's wrong from the error message.

Here's a repl: https://svelte.dev/repl/03ce54696b44445fbc8edbfa1c77696c?version=3.12.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions