Linux下部署ant-design-pro大小写敏感问题

现象描述

在Mac和Win上打包没问题,放到Centos下打包报错:

$ yarn build
yarn run v1.19.1
$ umi build

✖ Webpack
  Compiled with some errors in 1.05m

 ERROR  Failed to compile with 1 errors                                                                                                                                                               11:06:50 AM

This relative module was not found:

* ../User/resetPwd in ./src/pages/.umi-production/router.js

 ERROR CODE  ERR_WEBPACK_MODULE_NOT_FOUND

 DETAILS

## Possible Reasons

    1. The file does not exist
    2. Case problem

If the build under mac is successful and the build fails under linux or on the cloud build platform, it must be case problem.

## Solution

If it is a case, please double check that the import or require file and the target file are in the same case.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

问题解决

文件引用大小写问题

参考:https://github.com/ant-design/ant-design-pro/issues/2267

case-sensitive-paths 插件检测路径大小写问题

  1. 添加 webpack 强制文件名大小写匹配的插件
yarn add case-sensitive-paths-webpack-plugin --dev
  1. 添加配置config/plugin.config.js
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';

config.plugin('case-sensitive-paths').use(CaseSensitivePathsPlugin, [
  {
    debug: true,
  },
])
  1. 启动开发服务,插件会检查文件名大小写并给出错误提醒
yarn start
上一篇 Taro入门实战
下一篇 uni-app小程序SDK
目录
文章列表
1 Vue组件中获得Vuex状态state的方法汇总
Vue组件中获得Vuex状态state的方法汇总
2
Spring Cloud Gateway自定义GatewayFilterFactory
Spring Cloud Gateway自定义GatewayFilterFactory
3
React Native学习之图片Image组件
React Native学习之图片Image组件
4
Flutter Widget之Radio
Flutter Widget之Radio
5
Spring Boot 基于DeferredResult的异步服务
Spring Boot 基于DeferredResult的异步服务
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。