You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,6 +106,37 @@
106
106
function n(){console.log("macOS")}export{n as logPlatform};
107
107
```
108
108
109
+
* Pass import attributes to on-resolve plugins ([#3384](https://github.com/evanw/esbuild/issues/3384), [#3639](https://github.com/evanw/esbuild/issues/3639), [#3646](https://github.com/evanw/esbuild/issues/3646))
110
+
111
+
With this release, on-resolve plugins will now have access to the import attributes on the import via the `with` property of the arguments object. This mirrors the `with` property of the arguments object that's already passed to on-load plugins. In addition, you can now pass `with` to the `resolve()` API call which will then forward that value on to all relevant plugins. Here's an example of a plugin that can now be written:
112
+
113
+
```js
114
+
const examplePlugin = {
115
+
name: 'Example plugin',
116
+
setup(build) {
117
+
build.onResolve({ filter: /.*/ }, args => {
118
+
if (args.with.type === 'external')
119
+
return { external: true }
120
+
})
121
+
}
122
+
}
123
+
124
+
require('esbuild').build({
125
+
stdin: {
126
+
contents: `
127
+
import foo from "./foo" with { type: "external" }
128
+
foo()
129
+
`,
130
+
},
131
+
bundle: true,
132
+
format: 'esm',
133
+
write: false,
134
+
plugins: [examplePlugin],
135
+
}).then(result => {
136
+
console.log(result.outputFiles[0].text)
137
+
})
138
+
```
139
+
109
140
* Formatting support for the `@position-try` rule ([#3773](https://github.com/evanw/esbuild/issues/3773))
110
141
111
142
Chrome shipped this new CSS at-rule in version 125 as part of the [CSS anchor positioning API](https://developer.chrome.com/blog/anchor-positioning-api). With this release, esbuild now knows to expect a declaration list inside of the `@position-try` body block and will format it appropriately.
0 commit comments