fix: path error when packaging the component style export file in the windeos environment (#31277)

In the windeos environment:
"Lib/style/components.less" will generate the following path "@import "../xx\style\index.less";" This is wrong
Now use path.posix.join to be compatible with multi-platform packaging
This commit is contained in:
aoxiang78 2021-07-07 17:53:14 +08:00 committed by GitHub
parent f9c4539fc7
commit 0984bae2cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@ function finalizeCompile() {
fs.readdir(componentsPath, (err, files) => { fs.readdir(componentsPath, (err, files) => {
files.forEach(file => { files.forEach(file => {
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) {
componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`; componentsLessContent += `@import "../${path.posix.join(file, 'style', 'index.less')}";\n`;
} }
}); });
fs.writeFileSync( fs.writeFileSync(