1.检查项目中是否存在许多未使用的CSS类。可以使用PurgeCSS将其删除,从而提高性能和构建速度。 2.在Angular.json文件中,将build.options.stylePreprocessorOptions单独配置为:
"stylePreprocessorOptions": {
"includePaths": [
"src/styles",
"./node_modules"
]
}
3.在angular.json文件中,可以添加以下代码来禁用Sourcemaps来优化构建速度:
"configurations": {
"production": {
"sourceMap": false,
// other options
}
}