Comments (2)
I'm confused. Can't you just access build.initialOptions
in your plugin? Something like this:
const esbuild = require('esbuild')
const pluginA = () => ({
name: 'pluginA',
setup(build) {
build.onStart(() => {
console.log(build.initialOptions)
})
}
})
const pluginB = () => ({
name: 'pluginB',
setup(build) {
build.initialOptions.absWorkingDir = '/'
}
})
esbuild.build({
plugins: [
pluginA(),
pluginB() // hahaha, absWorkingDir will be changed ๐ฟ
]
})
You just need to wait until setup is complete. One way to do that is with onStart
. I suppose it could be a problem if some plugin continues to mutate build.initialOptions
over time. But esbuild doesn't attempt to defend against plugins that are actively trying to break things.
from esbuild.
Can't you just access
build.initialOptions
in your plugin?
Yeah, it works. Sorry for such stupid issue, I though that 'build' object is not shared 'as is' for all plugins :-/
I suppose it could be a problem if some plugin continues to mutate
build.initialOptions
over time.
For me it's a 'broken' plugin should be fixed / replaced so that's is not an issue.
And thank you for warm, prompt answer and such beautiful tool!
from esbuild.
Related Issues (20)
- `OnLoad` in custom plugin is called for disabled modules
- Specifying where compiled CSS files stored
- Assigning to the variable `name` doesnโt work when bundling to ESM output HOT 2
- [Documentation] Document the failure mode for unsupported node-specific features in dependencies HOT 1
- serve proxy with http2 possible? HOT 1
- A crash happened between switches of branches HOT 1
- Random "all goroutines are asleep - deadlock!" on a build HOT 2
- "all goroutines are asleep - deadlock!" on a build HOT 7
- esbuild + ESM + NodeJS + Typescript troubles HOT 6
- Different behaviour between external path and external package
- [Feature Request]: extend `onResolve` plugin hook to include import attributes in `import-statement`
- pnpm install error running postinstall scripts HOT 2
- [Feature Request]: Provide a way to selectively keep class / function names HOT 2
- default export interpretation HOT 2
- `--watch` should delete destination files on build errors HOT 4
- Bundled image is broken on the production HOT 3
- Constant folding doesn't simplify inequalities
- Cannot implement import attribute `with { type: "external" }` HOT 2
- css nesting lowering doesn't work when both a pseudo element selector and a class selector is used HOT 1
- Different bundle output between macOS and Ubuntu HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esbuild.