umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.39k stars 2.65k forks source link

[Bug] [app.model] namespace should be unique #6830

Closed huyawei closed 3 years ago

huyawei commented 3 years ago

image umi 3.5.0 3.3.11是好的,看到更新构建提速 就更新了下直接报这个错误

huyawei commented 3 years ago

自己试了试 只要开mfsu就报错 只开webpack5没问题关掉webpack5也没问题

sorrycc commented 3 years ago

看这截图没看到冲突,给个复现仓库?

huyawei commented 3 years ago

看这截图没看到冲突,给个复现仓库?

"dependencies": { "antd": "4.16.0", "react-amap": "1.2.8", "react": "16.12.0", "react-dom": "16.12.0", "tslib": "2.1.0" }, "devDependencies": { "@umijs/fabric": "2.2.2", "@umijs/preset-react": "1.4.8", "babel-eslint": "10.0.1", "babel-plugin-import": "1.13.3", "cross-env": "6.0.0", "eslint": "6.8.0", "eslint-config-umi": "1.6.0", "eslint-loader": "4.0.2", "eslint-plugin-flowtype": "4.6.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jsx-a11y": "6.2.1", "eslint-plugin-react": "7.14.0", "eslint-plugin-react-hooks": "2.5.0", "husky": "4.2.0", "less-vars-to-js": "1.3.0", "lint-staged": "10.0.0", "umi": "3.5.0" }

这是用的包 我把page全部删掉就留个登录 全局的model 就会报错但是不是这个错误 pages下有2个以及2个以上的model 就会namespace唯一键冲突

huyawei commented 3 years ago

import { resolve } from 'path'

export default {
  favicon: '/favicon.ico',
  title: '测试',
  metas: [
    { 'http-equiv': 'Cache-Control', 'content': 'no-cache, no-store, must-revalidate' },
    { 'http-equiv': 'Pragma', 'content': 'no-cache', },
    { 'http-equiv': 'Expires', 'content': '0' },
  ],
  ignoreMomentLocale: true,
  antd: {},
  dva: { hmr: true },
  // mfsu: {},
  // webpack5: {},
  dynamicImport: {},
  pwa: false,
  outputPath: `./dist/${process.env.APP_KEY}`,
  lessLoader: { javascriptEnabled: true },
  alias: {
    components: resolve(__dirname, './src/components'),
    utils: resolve(__dirname, './src/utils'),
  },
  nodeModulesTransform: { type: 'none' },
  extraBabelPlugins: [
    [
      'import',
      {
        libraryName: 'lodash',
        libraryDirectory: '',
        camel2DashComponentName: false,
      },
      'lodash',
    ],
  ],
  devtool: false,
  define: {
    "process.env.APP_KEY": '0',
    "process.env.API": ['develop', 'pre', 'master'].indexOf(process.env.APP_KEY),
  },
  chainWebpack(config) {
    config.module
      .rule('lint')
      .test(/\.js(x)?$/)
      .pre()
      .include.add(resolve(__dirname, './src/pages'))
      .end()
      .use('eslint')
      .loader('eslint-loader');
  },
}
``` ```
sorrycc commented 3 years ago

能给个复现仓库吗?

github-actions[bot] commented 3 years ago

Hello @huyawei. In order to facilitate location and troubleshooting, we need you to provide a realistic example. Please forking these link codesandbox umi or using yarn create @umijs/umi-app to create and upload it to your GitHub repository.

你好 @huyawei, 为了方便定位和排查问题,我们需要你提供一个重现实例,请提供一个尽可能精简的链接 codesandbox umi 或使用 yarn create @umijs/umi-app 创建,并上传到你的 GitHub 仓库。