Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [BUG]项目在微信开发者工具中无法运行报错 #11366

Closed
xyy7260 opened this issue Oct 12, 2024 · 0 comments
Closed

🐛 [BUG]项目在微信开发者工具中无法运行报错 #11366

xyy7260 opened this issue Oct 12, 2024 · 0 comments

Comments

@xyy7260
Copy link

xyy7260 commented Oct 12, 2024

🐛 bug 描述

我项目在微信开发中运行出现了一下问题
image
[我尝试使用这个方法也不行
尝试把
mfsu:{}, 屏蔽也不行

我部署在服务器上 然后通过服务器网址却能打开 本地调测的地址却不行
config 配置如下

export default defineConfig({
  jsMinifier: 'terser', // 🟢 换压缩器

  publicPath: '/crc/', // 修改打包路径
  esbuildMinifyIIFE: true,
  /**
   * @name 开启 hash 模式
   * @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
   * @doc https://umijs.org/docs/api/config#hash
   */
  hash: true,
  plugins: [],
  antd: {},
  dva: {},
  layout: {
    // https://umijs.org/zh-CN/plugins/plugin-layout
    locale: true,
    siderWidth: 208,
    ...defaultSettings,
  },
  /**
   * @name moment2dayjs 插件
   * @description 将项目中的 moment 替换为 dayjs
   * @doc https://umijs.org/docs/max/moment2dayjs
   */
  moment2dayjs: {
    preset: 'antd',
    plugins: ['duration'],
  },
  // https://umijs.org/zh-CN/plugins/plugin-locale
  locale: {
    // default zh-CN
    default: 'zh-CN',
    antd: true,
    // default true, when it is true, will use `navigator.language` overwrite default
    baseNavigator: true,
  },
  chainWebpack(memo, { env, webpack }) {
    if (env === 'production') {
      // 修改js,js chunk文件输出目录
      memo.output.publicPath('/crc/');

      memo.plugin('compression-webpack-plugin').use(new CompressionWebpackPlugin(), [
        {
           
          test: /\.js$|\.html$|\.css$/, //匹配文件名
          threshold: 10240, //对超过10k的数据压缩
          deleteOriginalAssets: false, //不删除源文件
        },
      ]);
    }
  },
  // umi routes: https://umijs.org/docs/routing
  routes,
  // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  theme: {
    // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
    // 只有设置为 variable, 才能使用 configProvide 动态设置主色调
    // https://ant.design/docs/react/customize-theme-variable-cn
    'root-entry-name': 'variable',
  },
  title: '',
  /**
   * @name moment 的国际化配置
   * @description 如果对国际化没有要求,打开之后能减少js的包大小
   * @doc https://umijs.org/docs/api/config#ignoremomentlocale
   */
  ignoreMomentLocale: true,
  proxy: proxy[REACT_APP_ENV || 'dev'],
  manifest: {
    basePath: '/',
  },
  // Fast Refresh 热更新
  fastRefresh: true,
  model: {},
  /**
   * 一个全局的初始数据流,可以用它在插件之间共享数据
   * @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。
   * @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81
   */
  initialState: {},
  request: {},
  access: {},
  headScripts: [
    // 解决首次加载时白屏的问题
    { src: '/scripts/loading.js', async: true },
  ],
  //================ pro 插件配置 =================
  presets: ['umi-presets-pro'],
 
 
  mfsu: {
    
  },
  requestRecord: {},
 
});

](umijs/umi#7042)

也尝试 rm -rf node_modules 和 .umijs 也不行

📷 复现步骤 | Recurrence steps

🏞 期望结果 | Expected results

💻 复现代码 | Recurrence code

© 版本信息

  • Ant Design Pro 版本: [e.g. 5.2.0]
  • umi 版本 "@umijs/max": "^4.1.10",
  • 浏览器环境 微信开发者工具的网页
  • 开发环境 [e.g. mac OS]
    其他配置
    "@umijs/plugins": "^4.1.10",
    "@umijs/preset-umi": "^4.1.10",
    "@umijs/route-utils": "^4.0.1",
    "@umijs/fabric": "^4.0.1",
    "@umijs/lint": "^4.1.10",
    "@umijs/max": "^4.1.10",

🚑 其他信息

@xyy7260 xyy7260 closed this as completed Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant