From 3523b64a03d677c2f8df61c121ff4fcb1d9db7f9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Sep 2017 22:16:39 +0200 Subject: [PATCH] Optimize imports --- client/config/webpack.common.js | 25 ------------------- client/config/webpack.dev.js | 22 ---------------- client/config/webpack.prod.js | 25 +++++++++++++++++++ .../app/+admin/users/shared/user.service.ts | 2 +- .../users/user-list/user-list.component.ts | 2 +- .../video-abuse-list.component.ts | 2 +- client/src/app/shared/rest/rest-table.ts | 3 ++- client/src/app/shared/rest/rest.service.ts | 2 +- client/src/app/shared/shared.module.ts | 3 ++- .../shared/video-abuse/video-abuse.service.ts | 2 +- 10 files changed, 34 insertions(+), 54 deletions(-) diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js index 7392c58d3..000699aa5 100644 --- a/client/config/webpack.common.js +++ b/client/config/webpack.common.js @@ -5,7 +5,6 @@ const helpers = require('./helpers') */ const AssetsPlugin = require('assets-webpack-plugin') -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin') const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin') const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin @@ -297,30 +296,6 @@ module.exports = function (options) { new ngcWebpack.NgcWebpackPlugin({ disabled: !AOT, tsConfig: helpers.root('tsconfig.webpack.json') - }), - - new BundleAnalyzerPlugin({ - // Can be `server`, `static` or `disabled`. - // In `server` mode analyzer will start HTTP server to show bundle report. - // In `static` mode single HTML file with bundle report will be generated. - // In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`. - analyzerMode: 'static', - // Path to bundle report file that will be generated in `static` mode. - // Relative to bundles output directory. - reportFilename: 'report.html', - // Automatically open report in default browser - openAnalyzer: false, - // If `true`, Webpack Stats JSON file will be generated in bundles output directory - generateStatsFile: true, - // Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`. - // Relative to bundles output directory. - statsFilename: 'stats.json', - // Options for `stats.toJson()` method. - // For example you can exclude sources of your modules from stats file with `source: false` option. - // See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21 - statsOptions: null, - // Log level. Can be 'info', 'warn', 'error' or 'silent'. - logLevel: 'info' }) ], diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js index 8948af9b2..d825f40e0 100644 --- a/client/config/webpack.dev.js +++ b/client/config/webpack.dev.js @@ -91,28 +91,6 @@ module.exports = function (env) { libraryTarget: 'var' }, - module: { - - // Too slow, life is short - // rules: [ - // { - // test: /\.ts$/, - // use: [ - // { - // loader: 'tslint-loader', - // options: { - // configFile: 'tslint.json' - // } - // } - // ], - // exclude: [ - // /\.(spec|e2e)\.ts$/, - // /node_modules\// - // ] - // } - // ] - }, - plugins: [ /** diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js index fc47f03a0..777c816e8 100644 --- a/client/config/webpack.prod.js +++ b/client/config/webpack.prod.js @@ -11,6 +11,7 @@ const videoEmbedConfig = require('./webpack.video-embed.js') * Webpack Plugins */ const DefinePlugin = require('webpack/lib/DefinePlugin') +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin') const OptimizeJsPlugin = require('optimize-js-plugin') @@ -249,6 +250,30 @@ module.exports = function (env) { path: helpers.root('dist') } } + }), + + new BundleAnalyzerPlugin({ + // Can be `server`, `static` or `disabled`. + // In `server` mode analyzer will start HTTP server to show bundle report. + // In `static` mode single HTML file with bundle report will be generated. + // In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`. + analyzerMode: 'static', + // Path to bundle report file that will be generated in `static` mode. + // Relative to bundles output directory. + reportFilename: 'report.html', + // Automatically open report in default browser + openAnalyzer: false, + // If `true`, Webpack Stats JSON file will be generated in bundles output directory + generateStatsFile: true, + // Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`. + // Relative to bundles output directory. + statsFilename: 'stats.json', + // Options for `stats.toJson()` method. + // For example you can exclude sources of your modules from stats file with `source: false` option. + // See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21 + statsOptions: null, + // Log level. Can be 'info', 'warn', 'error' or 'silent'. + logLevel: 'info' }) ], diff --git a/client/src/app/+admin/users/shared/user.service.ts b/client/src/app/+admin/users/shared/user.service.ts index a4b89bf1d..e4bd5df37 100644 --- a/client/src/app/+admin/users/shared/user.service.ts +++ b/client/src/app/+admin/users/shared/user.service.ts @@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable' import 'rxjs/add/operator/catch' import 'rxjs/add/operator/map' -import { SortMeta } from 'primeng/primeng' +import { SortMeta } from 'primeng/components/common/sortmeta' import { BytesPipe } from 'angular-pipes/src/math/bytes.pipe' import { RestExtractor, User, RestPagination, RestService } from '../../../shared' diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 73b5c0ce9..6debf89be 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core' -import { SortMeta } from 'primeng/primeng' +import { SortMeta } from 'primeng/components/common/sortmeta' import { NotificationsService } from 'angular2-notifications' diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts index 92de11f0e..654603d01 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core' import { NotificationsService } from 'angular2-notifications' -import { SortMeta } from 'primeng/primeng' +import { SortMeta } from 'primeng/components/common/sortmeta' import { RestTable, RestPagination, VideoAbuseService } from '../../../shared' import { VideoAbuse } from '../../../../../../shared' diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/shared/rest/rest-table.ts index db2cb5e14..d04d91c68 100644 --- a/client/src/app/shared/rest/rest-table.ts +++ b/client/src/app/shared/rest/rest-table.ts @@ -1,4 +1,5 @@ -import { LazyLoadEvent, SortMeta } from 'primeng/primeng' +import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent' +import { SortMeta } from 'primeng/components/common/sortmeta' import { RestPagination } from './rest-pagination' diff --git a/client/src/app/shared/rest/rest.service.ts b/client/src/app/shared/rest/rest.service.ts index f7838ba06..a1c301050 100644 --- a/client/src/app/shared/rest/rest.service.ts +++ b/client/src/app/shared/rest/rest.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' import { HttpParams } from '@angular/common/http' -import { SortMeta } from 'primeng/primeng' +import { SortMeta } from 'primeng/components/common/sortmeta' import { RestPagination } from './rest-pagination' diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index a28ac322d..56da62fc4 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts @@ -10,7 +10,8 @@ import { BsDropdownModule } from 'ngx-bootstrap/dropdown' import { ProgressbarModule } from 'ngx-bootstrap/progressbar' import { PaginationModule } from 'ngx-bootstrap/pagination' import { ModalModule } from 'ngx-bootstrap/modal' -import { DataTableModule, SharedModule as PrimeSharedModule } from 'primeng/primeng' +import { DataTableModule } from 'primeng/components/datatable/datatable' +import { SharedModule as PrimeSharedModule } from 'primeng/components/common/shared' import { AUTH_INTERCEPTOR_PROVIDER } from './auth' import { RestExtractor, RestService } from './rest' diff --git a/client/src/app/shared/video-abuse/video-abuse.service.ts b/client/src/app/shared/video-abuse/video-abuse.service.ts index 984581114..8d979de31 100644 --- a/client/src/app/shared/video-abuse/video-abuse.service.ts +++ b/client/src/app/shared/video-abuse/video-abuse.service.ts @@ -4,7 +4,7 @@ import 'rxjs/add/operator/catch' import 'rxjs/add/operator/map' import { Observable } from 'rxjs/Observable' -import { SortMeta } from 'primeng/primeng' +import { SortMeta } from 'primeng/components/common/sortmeta' import { AuthService } from '../core' import { RestExtractor, RestPagination, RestService } from '../rest' -- 2.41.0