//vue.config.js const TransformPages = require('uni-read-pages') const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin') const {webpack} = new TransformPages() module.exports = { configureWebpack: { plugins: [ new webpack.DefinePlugin({ ROUTES: webpack.DefinePlugin.runtimeValue(() => { const tfPages = new TransformPages({ includes: ['path', 'name', 'aliasPath'] }); return JSON.stringify(tfPages.routes) }, true ) }) ] }, configureWebpack: (config) => { // 限制工作线程使用1024MB内存 // get a reference to the existing ForkTsCheckerWebpackPlugin const existingForkTsChecker = config.plugins.filter( p => p instanceof ForkTsCheckerWebpackPlugin, )[0] // remove the existing ForkTsCheckerWebpackPlugin // so that we can replace it with our modified version config.plugins = config.plugins.filter( p => !(p instanceof ForkTsCheckerWebpackPlugin), ); // copy the options from the original ForkTsCheckerWebpackPlugin // instance and add the memoryLimit property const forkTsCheckerOptions = existingForkTsChecker.options; forkTsCheckerOptions.memoryLimit = 1024; config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerOptions)); }, transpileDependencies: ['uview-ui'] }