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: 'client-trace-v5-[name].js', chunkFilename: 'client-trace-v5-chunk-[name].js', }, watchOptions: { ignored: ['**/node_modules', '/bat/', '/dist/', '/public/', '/static/', '/test/'], poll: 2000, }, devServer: { port: 8091, compress: false, proxy: { '/api': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/static': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/content': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/dashboard': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/mock': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/authApi': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/Dictionary': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/Files': { target: 'https://a.leanwo.com/', ws: false, changeOrigin: true, secure:true, }, '/WebSocket': { target: 'https://a.leanwo.com/', ws: true, changeOrigin: true, }, '/TrainVideo': { target: 'https://a.leanwo.com/', ws: true, changeOrigin: true, }, '/gateway-api': { target: 'https://a.leanwo.com/', ws: true, changeOrigin: true, secure:true, }, }, headers: { 'Access-Control-Allow-Origin': '*', }, }, 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'] }) ]) })