| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- const path = require('path');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const WebpackMerge = require('webpack-merge');
- const baseConfig = require('./webpack.base.js');
- module.exports = WebpackMerge.merge(baseConfig, {
- mode: 'development',
- //开发环境下默认启用cache,在内存中对已经构建的部分进行缓存
- //避免其他模块修改,但是该模块未修改时候,重新构建,能够更快的进行增量构建
- //属于空间换时间的做法
- cache: true,
-
- // 代码入口
- entry: {
- // 注册界面
- main: './src/main.js',
- },
- output: {
- path: path.resolve(__dirname, '../dist'),
- publicPath: '/',
- filename: 'app-client-[name].js',
- chunkFilename: 'app-client-chunk-[name].js',
- },
- watchOptions: {
- ignored: ['**/node_modules', '/bat/', '/dist/', '/public/', '/static/', '/test/'],
- poll: 2000,
- },
- devServer: {
- port: 8081,
- compress: false,
-
- // 修复BUG:Invalid Host header
- allowedHosts: 'all',
- static: [
- {
- directory: path.join(__dirname, 'client-base-v4/static'),
- publicPath: '/static',
- },
- {
- directory: path.join(__dirname, 'client-base-v4/public'),
- publicPath: '/',
- },
- ],
- // historyApiFallback: true,
- // historyApiFallback: {
- // rewrites: [
- // { from: /.*/, to: path.posix.join('/', 'index.html') },
- // ],
- // },
- headers: {
- 'Access-Control-Allow-Origin': '*',
- // eslint-disable-next-line max-len
- //'Content-Security-Policy': 'upgrade-insecure-requests; default-src \'none\'; base-uri \'self\'; frame-ancestors \'none\'; script-src \'self\' \'nonce-11111\'; connect-src \'self\'; form-action \'self\'; frame-src \'self\'; img-src \'self\'; font-src \'self\'; style-src \'self\' \'nonce-11111\'; manifest-src \'none\'; worker-src \'self\'; media-src \'self\'; object-src \'self\';',
- },
-
- proxy: {
- '/api': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/static': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/content': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/dashboard': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/assets': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/mock': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/authApi': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/Dictionary': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/Files': {
- target: 'http://192.168.1.5:10025/',
- ws: false,
- changeOrigin: true,
- secure:true,
- },
- '/WebSocket': {
- target: 'http://192.168.1.5:10025/',
- ws: true,
- changeOrigin: true,
- },
- '/TrainVideo': {
- target: 'http://192.168.1.5:10025/',
- ws: true,
- changeOrigin: true,
- },
- '/module': {
- target: 'http://192.168.1.5:10025/',
- ws: true,
- changeOrigin: true,
- secure:true,
- },
- },
- client: {
- overlay: false //解决ResizeObserver loop completed with undelivered notifications
- },
- },
- devtool: 'source-map',
- plugins: (module.exports.plugins || []).concat([
- new HtmlWebpackPlugin({
- title: 'Prodog',
- template: './public/index-debug.html', // 源模板文件
- filename: './index.html', // 输出文件【注意:这里的根路径是module.exports.output.path】
- chunks: ['main'],
- }),
- ]),
- });
|