Skip to content

style-loader/useable: passing insertInto through options #327

Closed
@mvoica

Description

@mvoica

a while ago, the option to have insertInto as a function instead of a string was added to the style-loader. And this is exactly what I needed - and it works great. Then I tried using this with /useable, and I noticed that in index.js we have this:

if (typeof options.insertInto === "function") {
insertInto = options.insertInto.toString();
}
...
"options.insertInto = " + insertInto + ";",
"var update = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "lib", "addStyles.js")) + ")(content, options);",

which makes the correct body of the function be included in the bundle,

while in the useable we have this:
" dispose = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "lib", "addStyles.js")) + ")(content, " + JSON.stringify(options) + ");",

which will omit the insertInto function.
Is there a particularity of the /useable that makes the usage with the insertInto (function) impossible?

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