Skip to content

Component name sanitisation #102

@antony

Description

@antony

I'm building svelte components dynamically, and part of this process is an intermediate file called .compiled.html which is essentially a svelte component built from a series of files.

What I'm seeing is that the compiled component adopts this intermediate filename as the exported module name. As you can imagine .compiled is not a valid Javascript variable name:

function .compiled ( options ) { // invalid variable name
	var component = this;
...
.compiled.prototype = template.methods;

export default .compiled;

This is an easy fix for me as I can simply specify the filename. However, I'd probably suggest that when I run:

svelte compile ./.compiled.html

that the default name is sanitized and either throws an error or is stripped of illegal characters during component generation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions