"use strict";
// 设置vue.config 相关配置
const path = require("path");

function resolve(dir) {
	return path.join(__dirname, dir);
}
const TransformPages = require('uni-read-pages')
const {webpack} = new TransformPages()

const name = "自营平台";

module.exports = {
	lintOnSave: process.env.NODE_ENV === "development",
	// 路径别名
	configureWebpack: {
		name: name,
		resolve: {
			alias: {
				"@": resolve("src"),
				"@api": resolve("src/api"),
				"@c": resolve("src/components"),
				"@a": resolve("src/assets"),
				"@s": resolve("src/styles"),
				"@u": resolve("src/utils"),
				"@v": resolve("src/pages"),
			},
		},
		plugins: [
			new webpack.DefinePlugin({
				ROUTES: webpack.DefinePlugin.runtimeValue(() => {
					const tfPages = new TransformPages({
						includes: ['path', 'name', 'aliasPath']
					});
					return JSON.stringify(tfPages.routes)
				}, true)
			})
		]
	},
}
