Skip to content

Commit

Permalink
fixed require path error - #128
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaufy committed May 10, 2017
1 parent 946587a commit 3ed844b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/wepy-cli/src/compile-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export default {
target = path.join(npmPath, path.relative(modulesPath, source));
needCopy = true;
} else {
target = source.replace(path.sep + 'src' + path.sep, path.sep + 'dist' + path.sep); // e:/dist/util
// e:/dist/util
target = util.getDistPath(source);
needCopy = false;
}
} else if (lib.indexOf('/') === -1 || lib.indexOf('/') === lib.length - 1) { // require('asset');
Expand Down
4 changes: 3 additions & 1 deletion packages/wepy-cli/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ const utils = {
let relative;
src = src || cache.getSrc();
dist = dist || cache.getDist();
ext = (ext ? ('.' + ext) : opath.ext);
if (typeof(opath) === 'string')
opath = path.parse(opath);
ext = (ext ? (ext[0] === '.' ? ext : ('.' + ext)) : opath.ext);
// 第三组件
if (opath.dir.indexOf(`${path.sep}${src}${path.sep}`) === -1 && opath.dir.indexOf('node_modules') > 1) {
relative = path.relative(path.join(this.currentDir, 'node_modules'), opath.dir);
Expand Down

0 comments on commit 3ed844b

Please sign in to comment.