diff --git a/lerna.json b/lerna.json index 36064fc851e8..ee14f1c41ef5 100644 --- a/lerna.json +++ b/lerna.json @@ -15,5 +15,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "16.3.1-canary.16" + "version": "16.3.1-canary.17" } \ No newline at end of file diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 331c2f5649ad..671214fdd7c2 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "keywords": [ "react", "next", diff --git a/packages/devlow-bench/package.json b/packages/devlow-bench/package.json index 16ca279ad8d3..c77dade413d4 100644 --- a/packages/devlow-bench/package.json +++ b/packages/devlow-bench/package.json @@ -1,7 +1,7 @@ { "name": "@vercel/devlow-bench", "private": true, - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "Benchmarking tool for the developer workflow", "repository": { "type": "git", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 7be3195d9322..c6d3104be06e 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "ESLint configuration used by Next.js.", "license": "MIT", "repository": { @@ -12,7 +12,7 @@ "dist" ], "dependencies": { - "@next/eslint-plugin-next": "16.3.1-canary.16", + "@next/eslint-plugin-next": "16.3.1-canary.17", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index dd2eac40d0d5..f6c6a0e4f1df 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,7 +1,7 @@ { "name": "@next/eslint-plugin-internal", "private": true, - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "ESLint plugin for working on Next.js.", "exports": { ".": "./src/eslint-plugin-internal.js" diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 05f0963ab76e..888572d0c77b 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/font/package.json b/packages/font/package.json index 36174066cb4a..b581b361e4e7 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 66ca7baf0b80..a37205ac3fff 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 7f01bae40359..6ed21f1dc71d 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 819b4174c0de..b13df55cd820 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 4863e19dedf3..3888a0159673 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-playwright/package.json b/packages/next-playwright/package.json index 1c8d9b6fbc2f..6d58c1b4c1a8 100644 --- a/packages/next-playwright/package.json +++ b/packages/next-playwright/package.json @@ -1,6 +1,6 @@ { "name": "@next/playwright", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "repository": { "url": "vercel/next.js", "directory": "packages/next-playwright" diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index fbe913bd4d4b..4dd892ae361e 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index fabc939b07d1..5e5107cc4a2d 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index b432a912f3e0..417df6213918 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-routing/package.json b/packages/next-routing/package.json index 0d4ff953c6cc..3d8a88bae828 100644 --- a/packages/next-routing/package.json +++ b/packages/next-routing/package.json @@ -1,6 +1,6 @@ { "name": "@next/routing", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "keywords": [ "react", "next", diff --git a/packages/next-rspack/package.json b/packages/next-rspack/package.json index 50c26e51b9c4..5b5a7cd97ae0 100644 --- a/packages/next-rspack/package.json +++ b/packages/next-rspack/package.json @@ -1,6 +1,6 @@ { "name": "next-rspack", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "repository": { "url": "vercel/next.js", "directory": "packages/next-rspack" diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index c313d012af56..9220d90c0a98 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "private": true, "files": [ "native/" diff --git a/packages/next/package.json b/packages/next/package.json index 07c7bbf23f1c..dd8aa63261c3 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -100,7 +100,7 @@ ] }, "dependencies": { - "@next/env": "16.3.1-canary.16", + "@next/env": "16.3.1-canary.17", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", @@ -164,11 +164,11 @@ "@modelcontextprotocol/sdk": "1.18.1", "@mswjs/interceptors": "0.42.0", "@napi-rs/triples": "1.2.0", - "@next/font": "16.3.1-canary.16", - "@next/polyfill-module": "16.3.1-canary.16", - "@next/polyfill-nomodule": "16.3.1-canary.16", - "@next/react-refresh-utils": "16.3.1-canary.16", - "@next/swc": "16.3.1-canary.16", + "@next/font": "16.3.1-canary.17", + "@next/polyfill-module": "16.3.1-canary.17", + "@next/polyfill-nomodule": "16.3.1-canary.17", + "@next/react-refresh-utils": "16.3.1-canary.17", + "@next/swc": "16.3.1-canary.17", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.61.0", "@rspack/core": "1.6.7", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 820e7b6deeec..2f1864f823c6 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 19c742dee8aa..fe2f49940f85 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "16.3.1-canary.16", + "version": "16.3.1-canary.17", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "16.3.1-canary.16", + "next": "16.3.1-canary.17", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "6.0.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b7f1fb30f897..9c9e6ec54393 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1024,7 +1024,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../eslint-plugin-next eslint: specifier: '>=9.0.0' @@ -1107,7 +1107,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../next-env '@swc/helpers': specifier: 0.5.23 @@ -1228,19 +1228,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../font '@next/polyfill-module': - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../react-refresh-utils '@next/swc': - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1956,7 +1956,7 @@ importers: devDependencies: '@napi-rs/cli': specifier: 3.7.2 - version: 3.7.2(@emnapi/runtime@1.9.2)(@types/node@20.17.7(patch_hash=fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab))(node-addon-api@6.1.0) + version: 3.7.2(@emnapi/runtime@1.11.2)(@types/node@20.17.7(patch_hash=fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab))(node-addon-api@6.1.0) cross-env: specifier: 6.0.3 version: 6.0.3 @@ -1983,7 +1983,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 16.3.1-canary.16 + specifier: 16.3.1-canary.17 version: link:../next outdent: specifier: 0.8.0 @@ -21867,7 +21867,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@napi-rs/cli@3.7.2(@emnapi/runtime@1.9.2)(@types/node@20.17.7(patch_hash=fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab))(node-addon-api@6.1.0)': + '@napi-rs/cli@3.7.2(@emnapi/runtime@1.11.2)(@types/node@20.17.7(patch_hash=fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab))(node-addon-api@6.1.0)': dependencies: '@inquirer/prompts': 8.5.2(@types/node@20.17.7(patch_hash=fe6957869a9b616ec526ededb72bbe846b863bd2349204218772df5c1e62d6ab)) '@napi-rs/cross-toolchain': 1.0.3 @@ -21882,7 +21882,7 @@ snapshots: semver: 7.8.5 typanion: 3.14.0 optionalDependencies: - '@emnapi/runtime': 1.9.2 + '@emnapi/runtime': 1.11.2 transitivePeerDependencies: - '@napi-rs/cross-toolchain-arm64-target-aarch64' - '@napi-rs/cross-toolchain-arm64-target-armv7' diff --git a/test/production/turbopack-wasm-output-tracing/app/api/wasm/route.js b/test/production/turbopack-wasm-output-tracing/app/api/wasm/route.js new file mode 100644 index 000000000000..f009a32a29ce --- /dev/null +++ b/test/production/turbopack-wasm-output-tracing/app/api/wasm/route.js @@ -0,0 +1,5 @@ +import { addOne } from 'wasm-dep' + +export async function GET() { + return Response.json({ result: await addOne(1) }) +} diff --git a/test/production/turbopack-wasm-output-tracing/app/layout.js b/test/production/turbopack-wasm-output-tracing/app/layout.js new file mode 100644 index 000000000000..a3a86a5ca1e1 --- /dev/null +++ b/test/production/turbopack-wasm-output-tracing/app/layout.js @@ -0,0 +1,7 @@ +export default function Root({ children }) { + return ( + + {children} + + ) +} diff --git a/test/production/turbopack-wasm-output-tracing/app/page.js b/test/production/turbopack-wasm-output-tracing/app/page.js new file mode 100644 index 000000000000..051969f4dd15 --- /dev/null +++ b/test/production/turbopack-wasm-output-tracing/app/page.js @@ -0,0 +1,3 @@ +export default function Page() { + return

hello

+} diff --git a/test/production/turbopack-wasm-output-tracing/next.config.js b/test/production/turbopack-wasm-output-tracing/next.config.js new file mode 100644 index 000000000000..ffb3995755af --- /dev/null +++ b/test/production/turbopack-wasm-output-tracing/next.config.js @@ -0,0 +1,3 @@ +module.exports = { + serverExternalPackages: ['wasm-dep'], +} diff --git a/test/production/turbopack-wasm-output-tracing/turbopack-wasm-output-tracing.test.ts b/test/production/turbopack-wasm-output-tracing/turbopack-wasm-output-tracing.test.ts new file mode 100644 index 000000000000..e94f367b5ace --- /dev/null +++ b/test/production/turbopack-wasm-output-tracing/turbopack-wasm-output-tracing.test.ts @@ -0,0 +1,40 @@ +import { nextTestSetup } from 'e2e-utils' + +describe('turbopack wasm output tracing', () => { + const { next, isTurbopack, isNextStart, isNextDeploy } = nextTestSetup({ + files: __dirname, + dependencies: { + 'wasm-dep': 'file:./wasm-dep', + }, + }) + + it('builds and serves a node route whose external package references a wasm module', async () => { + const res = await next.fetch('/api/wasm') + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ result: 2 }) + }) + + if (isNextStart && !isNextDeploy) { + it('does not list the embedded wasm runtime helper in the route trace', async () => { + const trace = (await next.readJSON( + '.next/server/app/api/wasm/route.js.nft.json' + )) as { files: string[] } + + // The `[turbopack-wasm]/**/loadWasm.ts` helper is compiled into the output + // chunk, it is not a deployable source file. Tracing it used to fail the + // build outright, because a traced file has to live in the project or in + // the output directory. + expect( + trace.files.filter( + (file) => file.includes('turbopack-wasm') || file.includes('loadWasm') + ) + ).toEqual([]) + + if (isTurbopack) { + // The wasm file itself has to stay in the trace, the external package + // reads it at runtime. + expect(trace.files.some((file) => file.endsWith('add.wasm'))).toBe(true) + } + }) + } +}) diff --git a/test/production/turbopack-wasm-output-tracing/wasm-dep/add.wasm b/test/production/turbopack-wasm-output-tracing/wasm-dep/add.wasm new file mode 100755 index 000000000000..f22496d0b6c8 Binary files /dev/null and b/test/production/turbopack-wasm-output-tracing/wasm-dep/add.wasm differ diff --git a/test/production/turbopack-wasm-output-tracing/wasm-dep/index.js b/test/production/turbopack-wasm-output-tracing/wasm-dep/index.js new file mode 100644 index 000000000000..c8e99523d4e5 --- /dev/null +++ b/test/production/turbopack-wasm-output-tracing/wasm-dep/index.js @@ -0,0 +1,18 @@ +const fs = require('fs') +const path = require('path') + +const WASM_PATH = path.join(__dirname, 'add.wasm') + +// This is never called: it only exists so that the module graph of this package +// reaches a WebAssembly module through a static reference, like packages that +// ship a bundler-friendly WASM entry next to a runtime fallback do. +exports.loadWasmModule = function loadWasmModule() { + return require('./add.wasm') +} + +// The runtime fallback, which is what the route below actually uses. +exports.addOne = async function addOne(value) { + const bytes = await fs.promises.readFile(WASM_PATH) + const { instance } = await WebAssembly.instantiate(bytes) + return instance.exports.add_one(value) +} diff --git a/test/production/turbopack-wasm-output-tracing/wasm-dep/package.json b/test/production/turbopack-wasm-output-tracing/wasm-dep/package.json new file mode 100644 index 000000000000..33df5d56e11e --- /dev/null +++ b/test/production/turbopack-wasm-output-tracing/wasm-dep/package.json @@ -0,0 +1,5 @@ +{ + "name": "wasm-dep", + "version": "1.0.0", + "main": "index.js" +} diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs index babf22822c90..c87c85565dd2 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs @@ -50,9 +50,9 @@ pub trait EcmascriptChunkPlaceable: ChunkableModule + Module { _estimated: bool, ) -> Vc; - /// Returns the content identity for cache invalidation. - /// Override this for modules whose content depends on more than just the module source - /// (e.g., async loaders that depend on available modules). + /// See [`ChunkItem::content_ident`] + /// + /// [`ChunkItem::content_ident`]: turbopack_core::chunk::ChunkItem::content_ident #[turbo_tasks::function] fn chunk_item_content_ident( self: Vc, diff --git a/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/dist/internal/marker.js b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/dist/internal/marker.js new file mode 100644 index 000000000000..1eec35ae47ec --- /dev/null +++ b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/dist/internal/marker.js @@ -0,0 +1 @@ +export const marker = 'resolved'; diff --git a/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/input.js b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/input.js new file mode 100644 index 000000000000..b6882c8c1d84 --- /dev/null +++ b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/input.js @@ -0,0 +1,2 @@ +import { marker } from '#internal/marker.js' +console.log(marker) diff --git a/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/output.js b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/output.js new file mode 100644 index 000000000000..11d5e425052e --- /dev/null +++ b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/output.js @@ -0,0 +1,5 @@ +;[ + 'test/unit/imports-wildcard/dist/internal/marker.js', + 'test/unit/imports-wildcard/input.js', + 'test/unit/imports-wildcard/package.json', +] diff --git a/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/package.json b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/package.json new file mode 100644 index 000000000000..83baaf34c0a2 --- /dev/null +++ b/turbopack/crates/turbopack-tracing/tests/node-file-trace/test/unit/imports-wildcard/package.json @@ -0,0 +1,7 @@ +{ + "name": "imports-wildcard", + "type": "module", + "imports": { + "#*.js": "./dist/*.js" + } +} diff --git a/turbopack/crates/turbopack-tracing/tests/unit.rs b/turbopack/crates/turbopack-tracing/tests/unit.rs index 2813cc54ba03..c130e2f17266 100644 --- a/turbopack/crates/turbopack-tracing/tests/unit.rs +++ b/turbopack/crates/turbopack-tracing/tests/unit.rs @@ -121,6 +121,7 @@ static ALLOC: turbo_tasks_malloc::TurboMalloc = turbo_tasks_malloc::TurboMalloc; #[case::imports("imports")] #[case::imports_module_sync("imports-module-sync")] #[case::imports_module_sync_cjs("imports-module-sync-cjs")] +#[case::imports_wildcard("imports-wildcard")] #[case::jsonc_parser_wrapper("jsonc-parser-wrapper")] // #[case::jsx_input("jsx-input")] // #[case::microtime_node_gyp("microtime-node-gyp")] diff --git a/turbopack/crates/turbopack/src/module_options/mod.rs b/turbopack/crates/turbopack/src/module_options/mod.rs index 3a4f43648ff4..8e344ce701a3 100644 --- a/turbopack/crates/turbopack/src/module_options/mod.rs +++ b/turbopack/crates/turbopack/src/module_options/mod.rs @@ -687,22 +687,34 @@ impl ModuleOptions { vec![ModuleRuleEffect::ModuleType(ModuleType::NodeAddon)], ), // WebAssembly + // In tracing mode these are `Raw` modules: a WebAssembly module is loaded through a + // generated JS loader that references an embedded runtime helper, which is compiled + // into the output and has no path on disk, so tracing it would produce a file + // reference that cannot be resolved to a real file. ModuleRule::new( RuleCondition::any(vec![ RuleCondition::ResourcePathEndsWith(".wasm".to_string()), RuleCondition::ContentTypeStartsWith("application/wasm".to_string()), ]), - vec![ModuleRuleEffect::ModuleType(ModuleType::WebAssembly { - source_ty: WebAssemblySourceType::Binary, - })], + if is_tracing { + vec![ModuleRuleEffect::ModuleType(ModuleType::Raw)] + } else { + vec![ModuleRuleEffect::ModuleType(ModuleType::WebAssembly { + source_ty: WebAssemblySourceType::Binary, + })] + }, ), ModuleRule::new( RuleCondition::any(vec![RuleCondition::ResourcePathEndsWith( ".wat".to_string(), )]), - vec![ModuleRuleEffect::ModuleType(ModuleType::WebAssembly { - source_ty: WebAssemblySourceType::Text, - })], + if is_tracing { + vec![ModuleRuleEffect::ModuleType(ModuleType::Raw)] + } else { + vec![ModuleRuleEffect::ModuleType(ModuleType::WebAssembly { + source_ty: WebAssemblySourceType::Text, + })] + }, ), ModuleRule::new( RuleCondition::any(vec![