-
-
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
[webextension] Allow dynamic manifest.json #8138
Comments
I'm working on a browser extension framework that uses Parcel underneath, and it basically does exactly what you described (i.e, the manifest is generated for you and the version and so on are taken from package.json). Feel free to check out the docs :D |
This could be very useful for me. At the moment I have a a little pre-build script that writes |
Accepting |
This would make caching and watch mode a lot more difficult. JS files can produce non-deterministic results, or may have dependencies on other files, npm packages, environment variables, etc. This is all very hard to track correctly, which is why we generally discourage JS-based config files. I would be hesitant to add another one. |
How is this different from any other file (as far as the dependencies are concerned)? // index.js
- import('./alpha.js')
+ import('./beta.js') // manifest.json.js
export default {
background: {
scripts: [
- "bg.js"
+ "background.js"
]
}
} They both change the graph. The only difference is that |
Because it isn't bundled, it's executed and the results are written. So anything that might change those results needs to invalidate the cache, not just the file itself. |
Maybe evaluate that JS on load and turn it into a string object or JSON? That way we could still read environment variables and other configurations before bundling. |
There could be some kind of JSON templating transformer that replaces |
With the templating system, it may be a good idea to use enviornment variables (it turns out that NPM has env variables for package versions, names, and other fields) - maybe a seperate issue / discussion should be raised for this new transformer? |
Part of the templating issue can be solved by using a custom transformer. Previously there were issues because the entry asset had to be |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
🙋 feature request
Everytime I update the extension, I must manually update manifest.json. It would be nice if I could use a manifest.js and get the version and other info directly from package.json.
🤔 Expected Behavior
Allow usage of manifest.js or add the option to get info from package.json.
😯 Current Behavior
It only accepts a manifest.json
💁 Possible Solution
Expect besides a JSON file, a JS object, a default export of JSON string or read from package.json.
🔦 Context
I'm trying to automate some upgrade tasks and I don't see any way of achieving this.
💻 Examples
This is possible with Rollup and Webpack:
https://github.com/crxjs/chrome-extension-tools
The text was updated successfully, but these errors were encountered: