Closed Cweili closed 5 years ago
Merging #104 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #104 +/- ##
=======================================
Coverage 60.92% 60.92%
=======================================
Files 12 12
Lines 302 302
Branches 58 58
=======================================
Hits 184 184
Misses 118 118
Impacted Files | Coverage Δ | |
---|---|---|
lib/parser/pages.js | 76.47% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 595d379...62a6310. Read the comment docs.
举例说明下这个的作用?
@F-loat 我们的工程目录结构,是把小程序通用的那部分 build、config、共用的组件等放在了一个 git submodule 里,然后在不同的小程序工程中引用,这样 pages 相对路径就在父级目录里了。
/
src
pages
framework
build
config
src
app.vue
main.js
// app.js
const path = require('path');
const resolve = (...paths) => path.resolve('../../src', ...paths);
module.exports = {
pages: [
{
route: 'pages/index/index',
path: resolve('pages/index/index') // Windows 下 -> ..\\..\\src\\pages\\index\\index
},
...
],
...
};
之前的代码用这样的配置,会把 entry 生成到我的源码目录(/src
)下。
在源码目录里同时会出现 index.js
与 index.vue
,在 index.js
中是 import '@..\\..\\src\\pages\\index\\index'
导致 webpack 认为 import 自身(.js
与 .vue
同时存在先找 .js
)造成编译错误。
好的
pages path 为父目录时,生成的 entry file 就不在 entry 目录中了