const TransformPages = require('uni-read-pages');
const { webpack } = new TransformPages();
// const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');

module.exports = {
  transpileDependencies: ['uview-ui'],
  configureWebpack: {
    stats: 'none',
    plugins: [
      new webpack.DefinePlugin({
        ROUTES: webpack.DefinePlugin.runtimeValue(() => {
          const tfPages = new TransformPages({
            includes: ['path', 'name', 'aliasPath'],
          });
          return JSON.stringify(tfPages.routes);
        }, true),
      }),
      // new FriendlyErrorsWebpackPlugin(),
    ],
  },
};
