| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- const path = require('path')
- const webpack = require('webpack')
- const fs = require('fs');
- const MiniCssExtractPlugin = require('mini-css-extract-plugin')
- const { VueLoaderPlugin } = require('vue-loader')
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const ESLintPlugin = require('eslint-webpack-plugin');
- const WebpackMerge = require('webpack-merge')
- const baseConfig = require('./webpack.base.js')
- module.exports = WebpackMerge.merge(baseConfig, {
- mode: 'development',
- //开发环境下默认启用cache,在内存中对已经构建的部分进行缓存
- //避免其他模块修改,但是该模块未修改时候,重新构建,能够更快的进行增量构建
- //属于空间换时间的做法
- cache: true,
- // 代码入口
- entry: {
- wmsapp: path.resolve(__dirname, './src/index.js'),
- },
- output: {
- path: path.resolve(__dirname, '../dist'),
- publicPath: '/',
- filename: 'eamapp-[name].js',
- chunkFilename: 'eamapp-chunk-[name].js',
- },
- devServer: {
- port: 8083,
- static: [
- {
- directory: path.join(__dirname, 'static-eam-app'),
- publicPath: '/static-eam-app',
- }
- ],
- // historyApiFallback: true,
- // historyApiFallback: {
- // rewrites: [
- // { from: /.*/, to: path.posix.join('/', 'index.html') },
- // ],
- // },
- headers: {
- 'Access-Control-Allow-Origin': '*',
- },
-
- proxy: {
- '/api': {
- target: 'http://localhost:83/',
- ws: false,
- changeOrigin: true
- },
- '/authApi': {
- target: 'http://localhost:83/',
- ws: false,
- changeOrigin: true
- },
- '/Dictionary': {
- target: 'http://localhost:83/',
- ws: false,
- changeOrigin: true
- },
- '/Files': {
- target: 'http://localhost:83/',
- ws: false,
- changeOrigin: true
- },
- },
- },
- devtool: 'source-map',
- plugins: (module.exports.plugins || []).concat([
- new HtmlWebpackPlugin({
- title: 'Prodog',
- template: './static-eam-app/index.html', // 源模板文件
- filename: './index.html', // 输出文件【注意:这里的根路径是module.exports.output.path】
- chunks: ['wmsapp']
- })
- ])
- })
|