mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
72 lines
1.4 KiB
JavaScript
72 lines
1.4 KiB
JavaScript
//@ts-check
|
|
|
|
'use strict';
|
|
|
|
const path = require('path');
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
|
|
const config = [{
|
|
name: 'panel',
|
|
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'],
|
|
fallback: { "path": require.resolve("path-browserify") }
|
|
},
|
|
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
|
|
},
|
|
plugins: [],
|
|
devServer: {
|
|
compress: true,
|
|
port: 9001,
|
|
hot: true,
|
|
allowedHosts: "all",
|
|
headers: {
|
|
"Access-Control-Allow-Origin": "*",
|
|
}
|
|
}
|
|
}];
|
|
|
|
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: "viewpanel.html",
|
|
openAnalyzer: false
|
|
}));
|
|
}
|
|
}
|
|
|
|
return config;
|
|
}; |