angular/projects/shell-chrome/shell-chrome-webpack.config.js
mgechev 681feff8d0 fix(devtools): recognize app after reopening devtools
Previously, Angular DevTools did not recognize the Angular application the second time the user reopens the extension tab. Webpack was preventing us to invoke twice a module with the same name. This PR changes the `content-script` to a library, allowing us to invoke it multiple times.
2021-05-11 08:38:07 -07:00

30 lines
898 B
JavaScript

const webpack = require('webpack');
module.exports = {
entry: {
// Use library so that the background script can invoke the content
// script multiple times. Alternatively, webpack is preventing us to do so.
'content-script': {
import: 'projects/shell-chrome/src/app/content-script.ts',
library: {
name: '___devToolsContentScript',
type: 'umd',
umdNamedDefine: true,
},
},
'ng-validate': 'projects/shell-chrome/src/app/ng-validate.ts',
background: 'projects/shell-chrome/src/app/background.ts',
backend: 'projects/shell-chrome/src/app/backend.ts',
devtools: 'projects/shell-chrome/src/devtools.ts',
},
output: {
chunkLoadingGlobal: '___ngDevToolsRuntime',
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
LATEST_SHA: JSON.stringify(process.env.LATEST_SHA),
},
}),
],
};