Skip to content

[Feature]: Support ?raw and ?inline in bundleless mode #899

Description

@Timeless0911

What problem does this feature solve?

At present, we externalize all request in bundleless mode, which means transform the source code.

For example, when users want to import raw CSS files as strings in JavaScript by using the ?raw query parameter in bundleless mode to avoid processing in app side since some app bundlers may not have some loader or users want to reduce loader processing in app side.

What does the proposed API look like?

Source code

import reactToastifyRootStyles from "react-toastify/dist/ReactToastify.css?raw";
const reactToastifyHostStyles = reactToastifyRootStyles.replaceAll(
  ":root",
  ":host"
);
console.log("reactToastifyHostStyles: ", reactToastifyHostStyles);

Actual

import * as __WEBPACK_EXTERNAL_MODULE_react_toastify_dist_ReactToastify_css_raw_922fb197__ from "react-toastify/dist/ReactToastify.css?raw";
const reactToastifyHostStyles = __WEBPACK_EXTERNAL_MODULE_react_toastify_dist_ReactToastify_css_raw_922fb197__["default"].replaceAll(":root", ":host");
console.log("reactToastifyHostStyles: ", reactToastifyHostStyles);

Expected

const ReactToastifyraw_namespaceObject = "";
const reactToastifyHostStyles = ReactToastifyraw_namespaceObject.replaceAll(
  ":root",
  ":host"
);
console.log("reactToastifyHostStyles: ", reactToastifyHostStyles);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions