Expand description
Utilities for Next.js written without a dependency on turbo-tasks, allowing them to be shared with webpack and/or rspack codepaths. This crate must be compilable to WASM, so that it works in environments where no native bindings are available.
These utilities should not perform file IO directly, but instead accept files they depend on as arguments (preferred) or via async trait methods or callbacks (acceptable). Follow “sans-io” patterns where possible.
Constants§
- BUN_
EXTERNALS - EDGE_
NODE_ EXTERNALS - List of node.js internals that are supported by edge runtime. If anything Node.js builtin module apart from these these imports are used and user does not provide alias for the polyfill, a runtime error will be thrown. See https://vercel.com/docs/functions/runtimes/edge-runtime#compatible-node.js-modules
- NODE_
EXTERNALS
Statics§
Functions§
- expand_
next_ js_ template - Given a next.js template file’s contents, replaces
replacementsandinjectionsand makes sure there are none left over. - expand_
next_ js_ template_ no_ imports - Same as
expand_next_js_template, but does not enforce that at least one relative import is present and rewritten. This is useful for very small templates that only use template variables/injections and have no imports of their own.