Skip to content

Commit

Permalink
fix(build): bad path generated while building in windows (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg authored and allen-zh committed May 8, 2019
1 parent f156ad5 commit f60fa38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/mars-build/package.json
Expand Up @@ -26,6 +26,7 @@
"node-sass": "^4.11.0",
"postcss": "^7.0.14",
"postcss-px2units": "^0.2.0",
"slash": "^3.0.0",
"stylus": "^0.54.5",
"through2": "^3.0.0",
"vinyl": "^2.2.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/mars-build/src/gulp-mars-base.js
Expand Up @@ -12,6 +12,7 @@ const PluginError = gutil.PluginError;
const PLUGIN_NAME = 'gulp-mars';
const path = require('path');
const mkdirp = require('mkdirp');
const slash = require('slash');

const {parse: sfcParser} = require('./compiler/sfc/parser');
const {compile: sfcCompiler} = require('./compiler/sfc/compiler');
Expand All @@ -28,7 +29,7 @@ function compile(file, opt, compilers) {
}
} = opt;
const rPath = path.relative(file.base, file.path);
const fPath = path.resolve(file.cwd, opt.dest, rPath).replace(/\.vue$/, '');
const fPath = slash(path.resolve(file.cwd, opt.dest, rPath).replace(/\.vue$/, ''));
const baseName = path.basename(fPath);

let coreRelativePath = path.join(
Expand All @@ -39,7 +40,7 @@ function compile(file, opt, compilers) {
opt.coreDir || 'common'
);
coreRelativePath = coreRelativePath[0] === '.' ? coreRelativePath : './' + coreRelativePath;
coreRelativePath = coreRelativePath + `/${target}/index`;
coreRelativePath = slash(coreRelativePath + `/${target}/index`);

try {
const dirPath = fPath.replace(/[^/]+$/, '');
Expand Down

0 comments on commit f60fa38

Please sign in to comment.