Skip to content

Commit

Permalink
fix(mini-runner): 修复引用 npm 中组件间存在依赖时依赖路径解析错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jan 7, 2020
1 parent 477e831 commit c4df170
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/taro-mini-runner/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const customizeChain = (chain, customizeFunc: Function) => {
}

export default function build (appPath: string, config: IBuildConfig, mainBuilder) {
const mode = 'development'
const mode = config.isWatch ? 'development' : 'production'
return new Promise((resolve, reject) => {
const webpackChain = buildConf(appPath, mode, config)

Expand Down
2 changes: 1 addition & 1 deletion packages/taro-mini-runner/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function buildUsingComponents (
}
componentPath = resolveScriptPath(path.resolve(filePath, '..', componentPath as string))
if (fs.existsSync(componentPath)) {
if (/node_modules/.test(componentPath)) {
if (NODE_MODULES_REG.test(componentPath) && !NODE_MODULES_REG.test(filePath)) {
componentPath = componentPath.replace(NODE_MODULES_REG, path.join(sourceDir, 'npm'))
}
componentPath = promoteRelativePath(path.relative(filePath, componentPath))
Expand Down

0 comments on commit c4df170

Please sign in to comment.