Browse Source

:bug: fix windos class name (#3183)

陈小聪 7 năm trước cách đây
mục cha
commit
d9ae08dc8f
2 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 3 2
      config/config.js
  2. 2 1
      package.json

+ 3 - 2
config/config.js

@@ -3,6 +3,7 @@ import os from 'os';
 import pageRoutes from './router.config';
 import pageRoutes from './router.config';
 import webpackPlugin from './plugin.config';
 import webpackPlugin from './plugin.config';
 import defaultSettings from '../src/defaultSettings';
 import defaultSettings from '../src/defaultSettings';
+import slash from 'slash2';
 
 
 const plugins = [
 const plugins = [
   [
   [
@@ -96,8 +97,8 @@ export default {
       }
       }
       const match = context.resourcePath.match(/src(.*)/);
       const match = context.resourcePath.match(/src(.*)/);
       if (match && match[1]) {
       if (match && match[1]) {
-        const antdProPath = match[1].replace('.less', '');
-        const arr = antdProPath
+        const antdProPath = match[1].replace('.less', '');        
+        const arr = slash(antdProPath)
           .split('/')
           .split('/')
           .map(a => a.replace(/([A-Z])/g, '-$1'))
           .map(a => a.replace(/([A-Z])/g, '-$1'))
           .map(a => a.toLowerCase());
           .map(a => a.toLowerCase());

+ 2 - 1
package.json

@@ -93,7 +93,8 @@
     "tslint-react": "^3.6.0",
     "tslint-react": "^3.6.0",
     "umi": "^2.2.7",
     "umi": "^2.2.7",
     "umi-plugin-ga": "^1.1.3",
     "umi-plugin-ga": "^1.1.3",
-    "umi-plugin-react": "^1.2.0"
+    "umi-plugin-react": "^1.2.0",
+    "slash2": "^2.0.0"
   },
   },
   "optionalDependencies": {
   "optionalDependencies": {
     "puppeteer": "^1.10.0"
     "puppeteer": "^1.10.0"