|
@@ -1,126 +0,0 @@
|
|
-const path = require('path')
|
|
|
|
-const webpack = require('webpack')
|
|
|
|
-const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
|
|
-const GenerateAssetPlugin = require('generate-asset-webpack-plugin')
|
|
|
|
-
|
|
|
|
-const Timestamp = new Date().getTime()
|
|
|
|
-
|
|
|
|
-const createServerConfig = function (compilation) {
|
|
|
|
- let config = { version: new Date().getTime() }
|
|
|
|
- return JSON.stringify(config)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const resolve = dir => {
|
|
|
|
- return path.join(__dirname, dir)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-const BASE_URL = process.env.NODE_ENV === 'production'
|
|
|
|
- ? '/'
|
|
|
|
- : '/';
|
|
|
|
-const ip = 'http://120.79.80.64:8050'
|
|
|
|
-
|
|
|
|
-module.exports = {
|
|
|
|
- devServer: {
|
|
|
|
- port: "8080",
|
|
|
|
- open: false,
|
|
|
|
- headers: {
|
|
|
|
- 'Access-Control-Allow-Origin': '*',
|
|
|
|
- },
|
|
|
|
- proxy: {
|
|
|
|
- '/cloudApi': {
|
|
|
|
- target: ip,
|
|
|
|
- ws: true,
|
|
|
|
- pathRewrite: {
|
|
|
|
- '^/api': '/'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- '/purchaseContract': {
|
|
|
|
- target: ip,
|
|
|
|
- ws: true,
|
|
|
|
- pathRewrite: {
|
|
|
|
- '^/api': '/'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- '/supplier': {
|
|
|
|
- target: ip,
|
|
|
|
- ws: true,
|
|
|
|
- pathRewrite: {
|
|
|
|
- '^/api': '/'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- '/javaApi': {
|
|
|
|
- target: ip,
|
|
|
|
- ws: true,
|
|
|
|
- pathRewrite: {
|
|
|
|
- '^/api': '/'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- publicPath: BASE_URL,
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- lintOnSave: true,
|
|
|
|
- chainWebpack: config => {
|
|
|
|
- config.resolve.alias
|
|
|
|
- .set('@', resolve('src'))
|
|
|
|
- .set('_c', resolve('src/components'))
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- productionSourceMap: false,
|
|
|
|
- configureWebpack: config => {
|
|
|
|
-
|
|
|
|
- if (process.env.NODE_ENV !== 'production') return
|
|
|
|
- else config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
|
|
|
|
- config.plugins.push(
|
|
|
|
- new CompressionWebpackPlugin({
|
|
|
|
-
|
|
|
|
- test: /\.(js|css|svg|woff|ttf|json|html)$/,
|
|
|
|
-
|
|
|
|
- threshold: 10240
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- config.plugins.push(
|
|
|
|
- new GenerateAssetPlugin({
|
|
|
|
- filename: 'version.json',
|
|
|
|
- fn: (compilation, cb) => {
|
|
|
|
- cb(null, createServerConfig(compilation))
|
|
|
|
- },
|
|
|
|
- extraFiles: []
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- config.plugins.push(
|
|
|
|
- new webpack.ProvidePlugin({
|
|
|
|
- $: 'jquery',
|
|
|
|
- jQuery: 'jquery',
|
|
|
|
- 'window.jQuery': 'jquery'
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- config.output.filename = `js/[name].${Timestamp}.js`
|
|
|
|
- config.output.chunkFilename = `js/[name].${Timestamp}.js`
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-}
|
|
|