const TransformPages = require("uni-read-pages");

const mock = require("./mock");

const { webpack } = new TransformPages();

module.exports = {
  productionSourceMap: true,

  devServer: {
    setupMiddlewares: mock,
    proxy: {},
  },

  transpileDependencies: ["@dcloudio/uni-ui"],

  configureWebpack: {
    plugins: [
      new webpack.DefinePlugin({
        ROUTES: webpack.DefinePlugin.runtimeValue(() => {
          const tfPages = new TransformPages({
            includes: ["path", "name", "meta", "aliasPath"],
          });
          return JSON.stringify(tfPages.routes);
        }, true),
      }),
    ],
  },
};
