Give all plugins access to config #4655
-
🙋 feature requestGive every plugin type access to a 🔦 ContextMy plugin for Parcel v1 needed access to configuration to function. In Parcel v1, getting config meant either reading directly from the filesystem or reading from 💻 ExamplesIn {
"runtimes": [
"parcel-runtime-thing",
["parcel-runtime-with-config", {
"my": "configuration",
"is": { "right": "here" },
"any": [
"json object is supported",
1234
]
}]
]
} In addition to the other parameters provided to the |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
How is this bad practice? I would argue the other way around is bad practice, due to the spread of config in tooling specific config files like parcelrc or webpack.config.js or whatever you lose the ability to re-use configs across bundlers and other tools like tests, ... For this you should probably add a key to pkg.json or an additional file like you stated it should not have any significant performance impact and we're gonna look into optimising this regardless anyway. We have good reasons for not allowing this and I doubt this will change. |
Beta Was this translation helpful? Give feedback.
-
So you're suggesting that plugins read config directly from the filesystem with a |
Beta Was this translation helpful? Give feedback.
-
Also, a secondary reason for suggesting this is that there is no |
Beta Was this translation helpful? Give feedback.
-
From the types https://github.com/parcel-bundler/parcel/blob/v2/packages/core/types/index.js Transformer |
Beta Was this translation helpful? Give feedback.
How is this bad practice? I would argue the other way around is bad practice, due to the spread of config in tooling specific config files like parcelrc or webpack.config.js or whatever you lose the ability to re-use configs across bundlers and other tools like tests, ...
For this you should probably add a key to pkg.json or an additional file like you stated it should not have any significant performance impact and we're gonna look into optimising this regardless anyway.
We have good reasons for not allowing this and I doubt this will change.