HMR support for panel development

This commit is contained in:
Elio Struyf
2022-01-12 14:09:59 +01:00
parent dee30923ff
commit b83c565e29
11 changed files with 151 additions and 103 deletions
+9 -66
View File
@@ -56,78 +56,21 @@ const config = [
}
}
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: "extension.html",
openAnalyzer: false
})
]
},
{
name: 'panelWebView',
target: 'web',
entry: './src/panelWebView/index.tsx',
output: {
filename: 'panelWebView.js',
path: path.resolve(__dirname, '../dist')
},
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.js', '.tsx', '.jsx']
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: [{
loader: 'ts-loader'
}]
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
}
]
},
performance: {
maxEntrypointSize: 400000,
maxAssetSize: 400000
},
// optimization: {
// splitChunks: {
// cacheGroups: {
// vendors: {
// test: /node_modules/,
// chunks: 'initial',
// filename: 'vendors.[contenthash].js',
// priority: 1,
// maxInitialRequests: 2, // create only one vendor file
// minChunks: 1,
// }
// }
// }
// },
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: "viewpanel.html",
openAnalyzer: false
})
]
plugins: []
}
];
module.exports = (env, argv) => {
for (const configItem of config) {
configItem.mode = argv.mode;
if (argv.mode === 'production') {
configItem.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: "extension.html",
openAnalyzer: false
}));
}
}
return config;