-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…orepo#3983) This implements webpack loader context api for `emitError` and `emitWarning`, each of which emit Turbopack issues at the appropriate error level. As with webpack’s implementation, `emitError` does _not_ cause builds to fail [0]. This uses next-dev issue snapshots (vercel/turborepo#3774) to test that issues are emitted. [0] https://webpack.js.org/api/loaders/#thisemiterror --------- Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
- Loading branch information
1 parent
a965e20
commit 78199f6
Showing
8 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
experimental: { | ||
turbo: { | ||
loaders: { | ||
".emit": ["emit-loader"], | ||
}, | ||
}, | ||
}, | ||
}; |
8 changes: 8 additions & 0 deletions
8
...s/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
18 changes: 18 additions & 0 deletions
18
...next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useEffect } from "react"; | ||
import source from "./hello.emit"; | ||
|
||
export default function Home() { | ||
useEffect(() => { | ||
// Only run on client | ||
import("@turbo/pack-test-harness").then(runTests); | ||
}); | ||
|
||
return null; | ||
} | ||
|
||
function runTests() { | ||
it("runs a simple loader", () => { | ||
// Emitted issues are snapshot in `issues/` | ||
expect(source).toBe(null); | ||
}); | ||
} |
11 changes: 11 additions & 0 deletions
11
...egration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-6d7f75.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PlainIssue { | ||
severity: Error, | ||
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", | ||
category: "loaders", | ||
title: "Issue while running loader", | ||
description: "Error: Error!\n", | ||
detail: "", | ||
documentation_link: "", | ||
source: None, | ||
sub_issues: [], | ||
} |
11 changes: 11 additions & 0 deletions
11
...egration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-9bd07c.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PlainIssue { | ||
severity: Warning, | ||
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", | ||
category: "loaders", | ||
title: "Issue while running loader", | ||
description: "Error: Warning!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:2:20)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at <anonymous>\n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n", | ||
detail: "", | ||
documentation_link: "", | ||
source: None, | ||
sub_issues: [], | ||
} |
11 changes: 11 additions & 0 deletions
11
...egration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-bb7ea7.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PlainIssue { | ||
severity: Error, | ||
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", | ||
category: "loaders", | ||
title: "Issue while running loader", | ||
description: "Error: Error!\n at Object.module.exports (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/node_modules/emit-loader/index.js:4:18)\n at LOADER_EXECUTION (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4134)\n at runSyncOrAsync (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4145)\n at iterateNormalLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5782)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5426)\n at readResource (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:55:17)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:6160)\n at processResource (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:5308)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4667)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4764)\n at <unknown> (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4896)\n at handleResult (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:1424)\n at loadLoader (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:963)\n at iteratePitchingLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:4794)\n at runLoaders (node_modules/.pnpm/next@13.1.7-canary.28_pjwopsidmaokadturxaafygjp4/node_modules/next/dist/compiled/loader-runner/LoaderRunner.js:1:8590)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:35:9)\n at <anonymous>\n at Module.transform (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_transforms_webpack-loaders.ts._.js:28:12)\n at <unknown> (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]__516bc8._.js:13:212)\n at Module.run (crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/.next/build/webpack_loaders/chunks/[turbopack-node]_ipc_evaluate.ts._.js:172:45)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n", | ||
detail: "", | ||
documentation_link: "", | ||
source: None, | ||
sub_issues: [], | ||
} |
11 changes: 11 additions & 0 deletions
11
...egration/next/webpack-loaders/emitted-errors/issues/Issue while running loader-ebe27b.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PlainIssue { | ||
severity: Warning, | ||
context: "[project]/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit", | ||
category: "loaders", | ||
title: "Issue while running loader", | ||
description: "Error: Warning!\n", | ||
detail: "", | ||
documentation_link: "", | ||
source: None, | ||
sub_issues: [], | ||
} |