diff --git a/packages/uni-cli-shared/lib/pages.js b/packages/uni-cli-shared/lib/pages.js index 6bdc944b47b5a4f268e94cd4e653432602316f08..965591a88e26733ec032ebecc0569c33860479eb 100644 --- a/packages/uni-cli-shared/lib/pages.js +++ b/packages/uni-cli-shared/lib/pages.js @@ -8,14 +8,11 @@ const { capitalize } = require('./util') -const { +const { + getJson, parseJson } = require('./json') -const { - getPagesJson -} = require('./uni_modules') - let mainEntry = '' let nvueMainEntry = '' @@ -35,6 +32,10 @@ function getNVueMainEntry () { } return nvueMainEntry } + +function getPagesJson () { + return processPagesJson(getJson('pages.json', true)) +} function parsePagesJson (content, loader) { return processPagesJson(parseJson(content, true), loader) diff --git a/packages/webpack-uni-pages-loader/lib/index.js b/packages/webpack-uni-pages-loader/lib/index.js index 18e614484ebc5efab5339f9dbf1a2104f2a023cd..93e61ebf99e4f6366b9511c13b40ab6d081b3ed2 100644 --- a/packages/webpack-uni-pages-loader/lib/index.js +++ b/packages/webpack-uni-pages-loader/lib/index.js @@ -30,7 +30,7 @@ function checkEmitFile (filePath, jsonObj, changedEmitFiles) { } module.exports = function (content, map) { - content = JSON.stringify(require('@dcloudio/uni-cli-shared/lib/uni_modules').getPagesJson(content)) + // content = JSON.stringify(require('@dcloudio/uni-cli-shared/lib/uni_modules').getPagesJson(content)) if (this.resourceQuery) { const params = loaderUtils.parseQuery(this.resourceQuery) if (params) { @@ -42,12 +42,12 @@ module.exports = function (content, map) { } } // add deps - global.uniModules.forEach(module => { - const uniModulePagesJsonPath = path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules', module, 'pages.json') - if (fs.existsSync(uniModulePagesJsonPath)) { - this.addDependency(uniModulePagesJsonPath) - } - }) + // global.uniModules.forEach(module => { + // const uniModulePagesJsonPath = path.resolve(process.env.UNI_INPUT_DIR, 'uni_modules', module, 'pages.json') + // if (fs.existsSync(uniModulePagesJsonPath)) { + // this.addDependency(uniModulePagesJsonPath) + // } + // }) if ( process.env.UNI_USING_COMPONENTS ||