Closed
Description
webpack is the most popular script bundler for JavaScript and other assets.
With webpack, we can benefit from:
- Transpilation of ES6 or TypeScript
- Code splitting/dynamic imports
- Effortless code minification
- Eliminating the need of
resource-suffix
with chunk hash
However, this adds the requirement of Node.js + NPM to the build dependencies. We need to care about:
- How to execute webpack
- How to bundle (vendor) node_modules
Below are some implementation notes:
- In rustdoc's build scripts we run webpack and then generate the code for including into the binary. Example:
resources.insert("bundle.ef0d81c.js", include_bytes!(concat!(env!("OUT_DIR"), "bundle.ef0d81c.js")));
- https://github.com/danethurber/webpack-manifest-plugin can be used for determining the file name.
Metadata
Metadata
Assignees
Labels
Category: A feature request, i.e: not implemented / a PR.Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the infrastructure team, which will review and decide on the PR/issue.Relevant to the release subteam, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.