帆软决策平台数据连接界面库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.3 KiB

const webpack = require('webpack');
const merge = require('webpack-merge');
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const chokidar = require('chokidar');
const { execSync } = require('child_process');
const dirs = require('./dirs');
const common = require('./webpack.common.js');
// 监听java文件改变自动编译java
chokidar
.watch('../constants/*.java', { ignored: /(^|[/\\])\../ })
.on('all', (event, path) => {
try {
execSync('npm run const');
} catch (e) {
console.error(e);
}
});
// 监听国际化文件并编译
chokidar
.watch('../i18n/*.properties', { ignored: /(^|[/\\])\../ })
.on('all', (event, path) => {
try {
execSync('npm run i18n');
} catch (e) {
console.error(e);
}
});
module.exports = merge(common, {
devtool: 'eval-source-map',
entry: {
show: ['./src/i18n.ts', './src/index.ts'],
},
output: {
path: dirs.DEST,
filename: 'show.dev.js',
},
devServer: {
contentBase: path.join(__dirname, '..'),
port: 10002,
liveReload: true,
proxy: {
'/webroot/decision/v10': {
target: 'http://localhost:8075',
secure: false,
},
'/webroot/decision/resources': {
target: 'http://localhost:8075',
secure: false,
}
},
},
plugins: [
new MiniCssExtractPlugin({
path: dirs.DEST,
filename: 'show.dev.css',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../index.html'),
}),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: require('cssnano'),
cssProcessorPluginOptions: {
preset: ['default', {
discardComments: {
removeAll: true,
},
normalizeUnicode: false
}]
},
canPrint: true
})
],
});