Closed yogithesymbian closed 3 years ago
i have run npm run build but i got the error. how to change or solve this ?
npm run build
this is my .umirc.js
.umirc.js
// https://umijs.org/config/ import { resolve } from 'path' const fs = require('fs') const path = require('path') const lessToJs = require('less-vars-to-js') const isDevelopment = process.env.NODE_ENV === 'development' // how to speed compile: https://umijs.org/guide/boost-compile-speed export default { // IMPORTANT! change next line to yours or delete. And hide in dev publicPath: isDevelopment ? '/' : 'http://xx.xx.xx.xx/apps/yogi/', alias: { api: resolve(__dirname, './src/services/'), components: resolve(__dirname, './src/components'), config: resolve(__dirname, './src/utils/config'), themes: resolve(__dirname, './src/themes'), utils: resolve(__dirname, './src/utils'), }, antd: {}, // a lower cost way to genereate sourcemap, default is cheap-module-source-map, could save 60% time in dev hotload devtool: 'eval', dva: { immer: true }, dynamicImport: { loading: 'components/Loader/Loader', }, extraBabelPresets: ['@lingui/babel-preset-react'], extraBabelPlugins: [ [ 'import', { libraryName: 'lodash', libraryDirectory: '', camel2DashComponentName: false, }, 'lodash', ], [ 'import', { libraryName: '@ant-design/icons', libraryDirectory: 'es/icons', camel2DashComponentName: false, }, 'ant-design-icons', ], ], hash: true, ignoreMomentLocale: true, // umi3 comple node_modules by default, could be disable nodeModulesTransform: { type: 'none', exclude: [], }, // Webpack Configuration proxy: { 'https://api.seniverse.com/api/v1/weather': { target: 'https://api.seniverse.com/', changeOrigin: true, pathRewrite: { '^/api/v1/weather': '/v3/weather' }, }, }, targets: { ie: 9 }, // Theme for antd // https://ant.design/docs/react/customize-theme theme: lessToJs( fs.readFileSync(path.join(__dirname, './src/themes/default.less'), 'utf8') ), chainWebpack: function (config, { webpack }) { config.merge({ optimization: { minimize: true, splitChunks: { chunks: 'all', minSize: 30000, minChunks: 3, automaticNameDelimiter: '.', cacheGroups: { react: { name: 'react', priority: 20, test: /[\\/]node_modules[\\/](react|react-dom|react-dom-router)[\\/]/, }, antd: { name: 'antd', priority: 20, test: /[\\/]node_modules[\\/](antd|@ant-design\/icons)[\\/]/, }, 'echarts-gl': { name: 'echarts-gl', priority: 30, test: /[\\/]node_modules[\\/]echarts-gl[\\/]/, }, zrender: { name: 'zrender', priority: 30, test: /[\\/]node_modules[\\/]zrender[\\/]/, }, echarts: { name: 'echarts', priority: 20, test: /[\\/]node_modules[\\/](echarts|echarts-for-react|echarts-liquidfill)[\\/]/, }, highcharts: { name: 'highcharts', priority: 20, test: /[\\/]node_modules[\\/]highcharts[\\/]/, }, recharts: { name: 'recharts', priority: 20, test: /[\\/]node_modules[\\/]recharts[\\/]/, }, draftjs: { name: 'draftjs', priority: 30, test: /[\\/]node_modules[\\/](draft-js|react-draft-wysiwyg|draftjs-to-html|draftjs-to-markdown)[\\/]/, }, async: { chunks: 'async', minChunks: 2, name: 'async', maxInitialRequests: 1, minSize: 0, priority: 5, reuseExistingChunk: true, }, }, }, }, }) }, }
but in local with serve ./dist with
export default { // IMPORTANT! change next line to yours or delete. And hide in dev publicPath: isDevelopment ? '/' : './',
its work in local , but in server always got not found http://xx.xx.xx.xx/api/v1/user 404 (Not Found)
in server, use nginx to let api proxy
i have run
npm run build
but i got the error. how to change or solve this ?this is my
.umirc.js
but in local with serve ./dist with
its work in local , but in server always got not found http://xx.xx.xx.xx/api/v1/user 404 (Not Found)