Browse Source

fix: reverse the order of style deps

eiinu 3 years ago
parent
commit
06c30570b3
1 changed files with 6 additions and 4 deletions
  1. 6 4
      jd/generate-unplugin-deps.cjs

+ 6 - 4
jd/generate-unplugin-deps.cjs

@@ -106,16 +106,18 @@ styleMap.forEach((value, key) => {
     return component !== key;
   });
   // gen style
-  const outputStyleCJs = `require('./index.scss');\n${deps
+  const outputStyleCJs = `${deps
     .map((component) => {
       return `require('../${component.toLowerCase()}/index.scss');\n`;
     })
-    .join('')}`;
-  const outputStyleMjs = `import './index.scss';\n${deps
+    .reverse()
+    .join('')}require('./index.scss');\n`;
+  const outputStyleMjs = `${deps
     .map((component) => {
       return `import '../${component.toLowerCase()}/index.scss';\n`;
     })
-    .join('')}`;
+    .reverse()
+    .join('')}import './index.scss';\n`;
 
   tasks.push(
     fs.outputFile(path.resolve(__dirname, `../dist/packages/${name}/style.cjs`), outputStyleCJs, 'utf8', () => {