-
-
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
Allow manifest.ts to be an entry for config-webextension #8594
Comments
Related: #8404 |
You can preprocess the manifest with some other transformer before the builtin transformer sees it. And I think something more declarative would be better instead of allowing arbitrary Javascript (which is another whole can of worms). E.g. some kind of template syntax in strings that gets replaced (similar to EJS/Nunjucks/...). |
@mischnic Hello, thank you for replying! I do not consider template syntax as a better solution than arbitrary javascript. It's natural to write config in code. But if one decides to go this way, then I think github action expression syntax can be used as inspiration.
Can you please provide an example of how this can be done? I'm not very familiar with parcel's transformer pipeline. |
{
"extends": "@parcel/config-webextension",
"transformers": {
"manifest.json": ["parcel-transformer-something", "..."]
}
} (the const {Transformer} = require('@parcel/plugin');
module.exports = new Transformer({
async transform({asset}) {
let code = await asset.getCode();
asset.setCode(applySomeTemplating(code));
return [asset];
}
}); |
Duplicate of #8138 |
🙋 feature request
Currently, it's only possible to have a static
manifest.json
file as an entry for@parcel/config-webextension
config.This makes it hard to have some conditional configuration for development and production.
If
manifest.ts
was allowed as an entry, it would be trivial to accomplish this.💻 Examples
For my case, I want
content_scripts
policies to be different for development and production environments. I.e. I want to be able to write something like this:Thanks!!
The text was updated successfully, but these errors were encountered: