Skip to content

Comment "stimulusFetch: 'lazy'" is dropped from Stimulus Controller #10

Closed
symfony/ux
#2304
@Kocal

Description

@Kocal

Hey :)

Given my Stimulus controller:

import { redo as commandRedo, undo as commandUndo } from "@codemirror/commands";
import { markdown } from "@codemirror/lang-markdown";
import { Compartment, EditorSelection } from "@codemirror/state";
import { githubDark } from "@fsegurai/codemirror-theme-github-dark";
import { githubLight } from "@fsegurai/codemirror-theme-github-light";
import { Controller } from "@hotwired/stimulus";
import { EditorView, basicSetup } from "codemirror";
import { codeLanguages } from "../codemirror/code_languages.js";
import { lightDarkThemeSwitcher } from "../codemirror/light_dark_theme_switcher.js";

/* stimulusFetch: 'lazy' */
export default class extends Controller {
    static targets = ["textarea"];
    static classes = ["editor"];

    /* ... */
}

After being minified, the comment /* stimulusFetch: 'lazy' */ disappear from the source code:
image

Which load the controller (even if not needed since there are no data-controller="markdown-editor" on the page) and load all the dependencies (a lot):
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions