03a09ba1e6
This updates the Turbopack build code to provide the same `routeModule` export for App Pages as the Webpack loader does. This also adapts the Turbopack and Webpack loaders to use a shared loader file that is templated. Fixes NEXT-1469 The template supports the following styles: # Injections ```ts declare const tree: LoaderCode ``` Allows you to define the variable in scope in TS, this lets you reference it with correct types within the rest of the file. ```ts // INJECT:tree ``` Is replaced by the variable that's injected. This lets you ensure the correct invocation/initilization order. # Variables Variables will be substituted in the TS code when found. It's only really useful for strings, as the definition looks for the following in the outputted JS code: ```ts "VAR_REPLACE_ME" ``` So you can have something like: ```ts const thing = new AmazingThing({ page: "VAR_PAGE" }) ``` And it'll be replaced by: ```ts const thing = new AmazingThing({ page: "/thing" }) ``` Where `VAR_PAGE` is `JSON.stringify("/thing")`. |
||
---|---|---|
.. | ||
crates | ||
native | ||
package.json | ||
README.md |
@next/swc
This package is responsible for swc compilation customized for next.js
Development
Run tests
cargo test
# Update snapshots and fixtures for tests
UPDATE=1 cargo test
Format code before submitting code
cargo fmt
Build the binary to integrate with next.js
pnpm build-native