web-infra-dev / web-infra-dev/rslib
[Feature]: Support `?raw` and `?inline` in bundleless mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 67
- Avg merge
- 6h 9m
- Merged PRs (30d)
- 57
Description
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);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing bundleless mode handling for imports using the ?raw and ?inline query parameters, then compare the generated actual and expected output in the issue. Done means these imports are transformed into inline values rather than external module references in bundleless output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100