-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Resolver improvements #6696
Resolver improvements #6696
Conversation
|
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached Bundles
React HackerNews ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. AtlasKit Editor ✅
Timings
Cold Bundles
Cached Bundles
Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. |
@@ -8,7 +8,7 @@ import NodeResolver from '@parcel/node-resolver-core'; | |||
const WEBPACK_IMPORT_REGEX = /\S+-loader\S*!\S+/g; | |||
|
|||
export default (new Resolver({ | |||
resolve({dependency, options, filePath}) { | |||
resolve({dependency, options, specifier}) { |
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.
👍 this name makes so much more sense
@@ -1452,6 +1452,7 @@ export type ResolveResult = {| | |||
/** An absolute path to the file. */ | |||
+filePath?: FilePath, | |||
+pipeline?: ?string, | |||
+query?: QueryParameters, |
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.
Can you document this? (That these are the query params the resolver didn't handle and should be forwarded to transformers)
if (!validPipelines.has(pipeline)) { | ||
// This may be a url protocol or scheme rather than a pipeline, such as | ||
// `url('http://example.com/foo.png')`. Pass it to resolvers to handle. | ||
// return {assetGroup: null}; |
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.
// return {assetGroup: null}; |
While trying to document the resolver, I came across some inconsistencies and opportunities for improvement.
['ts', 'tsx', 'js', 'jsx', 'json']
.?
character is allowed in filenames (just not on Windows...).npm:
scheme, which allows URL dependencies to resolve tonode_modules
packages rather than as a relative path. Useful for e.g. CSS and web workers. Fixes Support Web Workers coming from node_modules #670. Closes Parcel 2: Specific resolvers per file type #3492.@import
declarations to the top of the packaged bundle. Fixes CSS @imports are not the first rule in the css output file #5484.filePath
option of resolver plugins tospecifier
since it may include things like query params and URL schemes. Note that this is slightly different fromdependency.specifier
in cases where a known named pipeline is used. In this case, thespecifier
passed to resolvers already has the pipeline stripped off.