web-pack sass-loader медленный с кендо для угловых
Используя шаблон Visual Studio 2017+ AspNet Core Angular2 SPA от JavaScriptServices + kendo UI для узла Angular + 6.11.2, я нахожу, что веб-пакет на F5 работает медленно, примерно 50 с, для моего проекта, в котором только 3 экрана. Я работал с --profile, и, например, время сборки sass-загрузчика, похоже, составляет 14 с (см. Последнюю строку), это нормально? Я знаю, что это старая версия webpack, но пакет aspnet-webpack имеет одноранговую зависимость, поэтому не думайте, что я могу легко обновиться.
node node_modules/webpack/bin/webpack.js --display-chunks --profile
Hash: c26022140be6adfd9fc78ed6696c3ce053c09701
Version: webpack 2.5.1
Child
Hash: c26022140be6adfd9fc7
Time: 50574ms
Asset Size Chunks Chunk Names
main-client.js 4.54 MB 0 [emitted] [big] main-client
main.css 456 kB 0 [emitted] [big] main-client
main-client.js.map 4.96 MB 0 [emitted] main-client
main.css.map 85 bytes 0 [emitted] main-client
chunk {0} main-client.js, main.css, main-client.js.map, main.css.map (main-client) 3.91 MB [entry] [rendered]
[0] delegated ./node_modules/@angular/core/@angular/core.es5.js from dll-reference vendor_f7dfad4be673dc844a12 42 bytes {0} [not cacheable] [built]
[] -> factory:3260ms building:0ms dependencies:0ms = 3260ms
[49] ./~/@angular/common/@angular/common/http.es5.js 82.8 kB {0} [built]
[] -> factory:7707ms building:980ms dependencies:1018ms = 9705ms
[210] ./ClientApp/app/claim.service.ts 2.29 kB {0} [built]
[] -> factory:48ms building:332ms dependencies:7327ms = 7707ms
[223] delegated ./node_modules/webpack/buildin/global.js from dll-reference vendor_f7dfad4be673dc844a12 42 bytes {0} [not cacheable] [built]
[] -> factory:7620ms building:0ms dependencies:0ms = 7620ms
[461] ./ClientApp/app/auth-guard.service.ts 1.46 kB {0} [built]
[] -> factory:48ms building:342ms dependencies:8238ms = 8628ms
[591] delegated ./node_modules/@angular/platform-browser/@angular/platform-browser.es5.js from dll-reference vendor_f7dfad4be673dc844a12 42 bytes {0} [not cacheable] [built]
[] -> factory:4061ms building:0ms dependencies:0ms = 4061ms
[596] ./ClientApp/app/app.module.browser.ts 1.99 kB {0} [built]
[] -> factory:3137ms building:83ms dependencies:40ms = 3260ms
[597] ./~/core-js/client/shim.js 228 kB {0} [built]
[] -> factory:3227ms building:279ms = 3506ms
[598] ./~/reflect-metadata/Reflect.js 48 kB {0} [built]
[] -> factory:3174ms building:142ms = 3316ms
[599] delegated ./node_modules/@angular/platform-browser-dynamic/@angular/platform-browser-dynamic.es5.js from dll-reference vendor_f7dfad4be673dc844a12 42 bytes {0} [not cacheable] [built]
[] -> factory:3261ms building:0ms dependencies:0ms = 3261ms
[600] delegated ./node_modules/bootstrap/dist/js/npm.js from dll-reference vendor_f7dfad4be673dc844a12 42 bytes {0} [not cacheable] [built]
[] -> factory:3271ms building:0ms dependencies:1ms = 3272ms
[601] delegated ./node_modules/zone.js/dist/zone.js from dll-reference vendor_f7dfad4be673dc844a12 42 bytes {0} [not cacheable] [built]
[] -> factory:3259ms building:0ms = 3259ms
[843] ./ClientApp/app/interceptors/date-tz.interceptor.ts 3.1 kB {0} [built]
[] -> factory:55ms building:428ms dependencies:7224ms = 7707ms
[844] ./ClientApp/boot.browser.ts 1 kB {0} [built]
factory:36ms building:3767ms = 3803ms
[932] delegated ./node_modules/process/browser.js from dll-reference vendor_f7dfad4be673dc844a12 42 bytes {0} [not cacheable] [built]
[] -> factory:7599ms building:0ms dependencies:0ms = 7599ms
+ 929 hidden modules
Child extract-text-webpack-plugin:
chunk {0} extract-text-webpack-plugin-output-filename 474 kB [entry] [rendered]
[0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[] -> factory:3ms building:7ms = 10ms
[1] ./~/css-loader!./~/sass-loader/lib/loader.js!./styles.scss 471 kB {0} [built]
factory:7ms building:9948ms = 9955ms
Child
Hash: 8ed6696c3ce053c09701
Time: 50697ms
Asset Size Chunks Chunk Names
main-server.js 11.3 MB 0 [emitted] [big] main-server
main.css 456 kB 0 [emitted] [big] main-server
chunk {0} main-server.js, main.css (main-server) 4.2 MB [entry] [rendered]
[0] delegated ./node_modules/@angular/core/bundles/core.umd.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:149ms building:0ms dependencies:0ms = 149ms
[4] delegated ./node_modules/rxjs/Observable.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:180ms building:0ms dependencies:0ms = 180ms
[6] delegated ./node_modules/@angular/common/bundles/common.umd.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:147ms building:0ms dependencies:0ms = 147ms
[14] delegated ./node_modules/rxjs/Subject.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:181ms building:0ms dependencies:0ms = 181ms
[184] ./~/@angular/platform-server/bundles/platform-server.umd.js 80.3 kB {0} [built]
[] -> factory:147ms building:266ms dependencies:139ms = 552ms
[509] delegated ./node_modules/rxjs/operator/first.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:3763ms building:0ms dependencies:0ms = 3763ms
[512] ./ClientApp/app/app.module.server.ts 1.05 kB {0} [built]
[] -> factory:40ms building:83ms dependencies:26ms = 149ms
[513] ./~/reflect-metadata/Reflect.js 48 kB {0} [built]
[] -> factory:113ms building:113ms = 226ms
[514] ./~/rxjs/add/operator/first.js 199 bytes {0} [built]
[] -> factory:149ms building:304ms dependencies:3723ms = 4176ms
[515] delegated ./node_modules/aspnet-prerendering/index.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:129ms building:0ms = 129ms
[516] delegated ./node_modules/zone.js/dist/zone-node.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:147ms building:0ms dependencies:0ms = 147ms
[670] ./ClientApp/app/app.module.shared.ts 2.95 kB {0} [built]
[] -> factory:36ms building:384ms dependencies:7375ms = 7795ms
[678] ./ClientApp/boot.server.ts 1.65 kB {0} [built]
factory:40ms building:6873ms = 6913ms
[771] ./~/xhr2/lib/xhr2.js 26 kB {0} [built]
[] -> factory:8313ms building:935ms dependencies:0ms = 9248ms
[773] delegated ./node_modules/@angular/compiler/bundles/compiler.umd.js from dll-reference ./vendor 42 bytes {0} [not cacheable] [built]
[] -> factory:8310ms building:0ms dependencies:0ms = 8310ms
+ 774 hidden modules
Child extract-text-webpack-plugin:
chunk {0} extract-text-webpack-plugin-output-filename 474 kB [entry] [rendered]
[0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[] -> factory:0ms building:69ms = 69ms
[1] ./~/css-loader!./~/sass-loader/lib/loader.js!./styles.scss 471 kB {0} [built]
factory:10ms building:14361ms = 14371ms
webpack.config.js:
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const AotPlugin = require('@ngtools/webpack').AotPlugin;
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const Uglify = require("uglifyjs-webpack-plugin");
module.exports = (env) => {
// Configuration in common to both client-side and server-side bundles
const isDevBuild = !(env && env.prod);
const extractCSS = new ExtractTextPlugin('main.css');
const sharedConfig = {
stats: { modules: false },
context: __dirname,
resolve: { extensions: [ '.js', '.ts' ] },
output: {
filename: '[name].js',
publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
},
module: {
rules: [
{ test: /\.ts$/, use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] : '@ngtools/webpack' },
{ test: /\.html$/, use: 'html-loader?minimize=false' },
{ test: /\.css$/, use: [ 'to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize' ] },
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' },
{
test: /\.scss$/,
// exclude: /node_modules/,
use: extractCSS.extract({
use: ['css-loader', 'sass-loader']
})
},
]
},
plugins: [new CheckerPlugin(), extractCSS]
};
// Configuration for client-side bundle suitable for running in browsers
const clientBundleOutputDir = './wwwroot/dist';
const clientBundleConfig = merge(sharedConfig, {
entry: { 'main-client': './ClientApp/boot.browser.ts' },
output: { path: path.join(__dirname, clientBundleOutputDir) },
plugins: [
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./wwwroot/dist/vendor-manifest.json')
})
].concat(isDevBuild ? [
// Plugins that apply in development builds only
new webpack.SourceMapDevToolPlugin({
filename: '[file].map', // Remove this line if you prefer inline source maps
moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
})
] : [
// Plugins that apply in production builds only
// new webpack.optimize.UglifyJsPlugin(), -- does not do es6
new Uglify(),
new AotPlugin({
tsConfigPath: './tsconfig.json',
entryModule: path.join(__dirname, 'ClientApp/app/app.module.browser#AppModule'),
exclude: ['./**/*.server.ts'],
})
])
});
// Configuration for server-side (prerendering) bundle suitable for running in Node
const serverBundleConfig = merge(sharedConfig, {
resolve: { mainFields: ['main'] },
entry: { 'main-server': './ClientApp/boot.server.ts' },
plugins: [
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./ClientApp/dist/vendor-manifest.json'),
sourceType: 'commonjs2',
name: './vendor'
})
].concat(isDevBuild ? [] : [
// Plugins that apply in production builds only
new AotPlugin({
tsConfigPath: './tsconfig.json',
entryModule: path.join(__dirname, 'ClientApp/app/app.module.server#AppModule'),
exclude: ['./**/*.browser.ts']
})
]),
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, './ClientApp/dist')
},
target: 'node',
devtool: 'inline-source-map'
});
return [clientBundleConfig, serverBundleConfig];
};
style.scss:
$button-bg: #0091D7;
$button-text: #ffffff;
$accent: #0190D6;
@import "~@progress/kendo-theme-default/scss/all";