-
Notifications
You must be signed in to change notification settings - Fork 28.6k
fix(turbopack): Pass resourceQuery
to loaders
#69703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
61b2493
Add a test
kdy1 8874251
More work for test
kdy1 cf375b2
Fix parsing of query string
kdy1 7226bea
Update test
kdy1 a956df8
Fix
kdy1 b904e99
Merge branch 'canary' into kdy1/pack-3228
kdy1 6010e3a
Only turbopack
kdy1 408b6a2
query as a separate arg
kdy1 ebb2418
minimal diff
kdy1 9f1d012
fmt
kdy1 03cb3fc
srartsWith
kdy1 c982bce
fmt
kdy1 7d5a401
review
kdy1 722e3ec
Update turbopack/crates/turbopack-node/js/src/transforms/webpack-load…
kdy1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
test/e2e/app-dir/turbopack-loader-resource-query/app/layout.tsx
This file contains hidden or 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,8 @@ | ||
import { ReactNode } from 'react' | ||
export default function Root({ children }: { children: ReactNode }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
test/e2e/app-dir/turbopack-loader-resource-query/app/page.tsx
This file contains hidden or 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,7 @@ | ||
// @ts-expect-error -- ignore | ||
import { v } from './test.mdx?test=hi' | ||
|
||
export default function Page() { | ||
console.log(v) | ||
return <p>hello world</p> | ||
} |
This file contains hidden or 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 @@ | ||
## Hello World |
15 changes: 15 additions & 0 deletions
15
test/e2e/app-dir/turbopack-loader-resource-query/next.config.js
This file contains hidden or 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,15 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
experimental: { | ||
turbo: { | ||
rules: { | ||
'*.mdx': { | ||
loaders: ['test-loader.js'], | ||
as: '*.js', | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
4 changes: 4 additions & 0 deletions
4
test/e2e/app-dir/turbopack-loader-resource-query/node_modules/test-loader.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
test/e2e/app-dir/turbopack-loader-resource-query/turbopack-loader-resource-query.test.ts
This file contains hidden or 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,16 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
;(process.env.TURBOPACK ? describe : describe.skip)( | ||
'turbopack-loader-resource-query', | ||
() => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
// Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API. | ||
it('should pass query to loader', async () => { | ||
await next.render$('/') | ||
|
||
expect(next.cliOutput).toContain('resource query: ?test=hi') | ||
}) | ||
} | ||
) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query.starts_with('?')
should always be true.This points out a bug somewhere else