I am trying to create a chrome extension using angular 10. On doing ng build --prod, hash is getting appended in the background.js bundle file like "background.6f24e1b6d7ac365xxxxx.js".
Is there a way I can remove the hash only for this bundle on doing ng build --prod?.
One thing I can do is renaming of this file using node as mentioned in custom bundle file name angular-cli. I am looking to achieve this via webpack or in any other way.
custom.webpack.config file (Needed this to copy manifest.json to dist folder and to transpile background.ts to background.js as it is not being using in the angular app)
const CopyWebPackPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = {
plugins: [
new CopyWebPackPlugin({
patterns:[
{from:'manifest.json', to:''}
]
}),
]
entry: { background: 'src/background.ts' }
}
manifest.json file for google chrome extension
{
"name": "Javascript",
"version": "1.0",
"description": "javascript",
"key": <chrome extension key>,
"manifest_version": 2,
"browser_action": {
"default_popup": "signin.html"
},
"background": {
"scripts": [
"./background.js"
]
},
"permissions": [
"identity"
]
}
background.ts file
This will contain code for google chrome extension in typescript or javascript
Note: I want to this only for two bundle runtime.js and background.js. I want to keep hashing in other bundles like main.xxxxxxxxxx.js, polyfills.xxxxxxxxxx.js, polyfills-es5.xxxxxxxxxx.js etc.