You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
802 B
25 lines
802 B
6 months ago
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.uniAppMainPlugin = void 0;
|
||
|
const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
|
||
|
const utils_1 = require("./utils");
|
||
|
function uniAppMainPlugin() {
|
||
|
const mainUTS = (0, uni_cli_shared_1.resolveMainPathOnce)(process.env.UNI_INPUT_DIR);
|
||
|
return {
|
||
|
name: 'uni:app-main',
|
||
|
apply: 'build',
|
||
|
async transform(code, id) {
|
||
|
if ((0, uni_cli_shared_1.normalizePath)(id) === mainUTS) {
|
||
|
code = await (0, utils_1.parseImports)(code);
|
||
|
return `
|
||
|
import './${uni_cli_shared_1.MANIFEST_JSON_UTS}'
|
||
|
import './${uni_cli_shared_1.PAGES_JSON_UTS}'
|
||
|
${code}
|
||
|
export default 'main.uts'
|
||
|
`;
|
||
|
}
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
exports.uniAppMainPlugin = uniAppMainPlugin;
|