Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

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