Optimize imports

This commit is contained in:
Chocobozzz 2017-09-14 22:16:39 +02:00
parent bfb3a98fac
commit 3523b64a03
10 changed files with 34 additions and 54 deletions

View File

@ -5,7 +5,6 @@ const helpers = require('./helpers')
*/ */
const AssetsPlugin = require('assets-webpack-plugin') const AssetsPlugin = require('assets-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin') const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin')
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin') const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin')
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin
@ -297,30 +296,6 @@ module.exports = function (options) {
new ngcWebpack.NgcWebpackPlugin({ new ngcWebpack.NgcWebpackPlugin({
disabled: !AOT, disabled: !AOT,
tsConfig: helpers.root('tsconfig.webpack.json') 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'
}) })
], ],

View File

@ -91,28 +91,6 @@ module.exports = function (env) {
libraryTarget: 'var' 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: [ plugins: [
/** /**

View File

@ -11,6 +11,7 @@ const videoEmbedConfig = require('./webpack.video-embed.js')
* Webpack Plugins * Webpack Plugins
*/ */
const DefinePlugin = require('webpack/lib/DefinePlugin') const DefinePlugin = require('webpack/lib/DefinePlugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin') const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
const OptimizeJsPlugin = require('optimize-js-plugin') const OptimizeJsPlugin = require('optimize-js-plugin')
@ -249,6 +250,30 @@ module.exports = function (env) {
path: helpers.root('dist') 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'
}) })
], ],

View File

@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable'
import 'rxjs/add/operator/catch' import 'rxjs/add/operator/catch'
import 'rxjs/add/operator/map' 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 { BytesPipe } from 'angular-pipes/src/math/bytes.pipe'
import { RestExtractor, User, RestPagination, RestService } from '../../../shared' import { RestExtractor, User, RestPagination, RestService } from '../../../shared'

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core' import { Component, OnInit } from '@angular/core'
import { SortMeta } from 'primeng/primeng' import { SortMeta } from 'primeng/components/common/sortmeta'
import { NotificationsService } from 'angular2-notifications' import { NotificationsService } from 'angular2-notifications'

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core' import { Component, OnInit } from '@angular/core'
import { NotificationsService } from 'angular2-notifications' import { NotificationsService } from 'angular2-notifications'
import { SortMeta } from 'primeng/primeng' import { SortMeta } from 'primeng/components/common/sortmeta'
import { RestTable, RestPagination, VideoAbuseService } from '../../../shared' import { RestTable, RestPagination, VideoAbuseService } from '../../../shared'
import { VideoAbuse } from '../../../../../../shared' import { VideoAbuse } from '../../../../../../shared'

View File

@ -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' import { RestPagination } from './rest-pagination'

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { HttpParams } from '@angular/common/http' import { HttpParams } from '@angular/common/http'
import { SortMeta } from 'primeng/primeng' import { SortMeta } from 'primeng/components/common/sortmeta'
import { RestPagination } from './rest-pagination' import { RestPagination } from './rest-pagination'

View File

@ -10,7 +10,8 @@ import { BsDropdownModule } from 'ngx-bootstrap/dropdown'
import { ProgressbarModule } from 'ngx-bootstrap/progressbar' import { ProgressbarModule } from 'ngx-bootstrap/progressbar'
import { PaginationModule } from 'ngx-bootstrap/pagination' import { PaginationModule } from 'ngx-bootstrap/pagination'
import { ModalModule } from 'ngx-bootstrap/modal' 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 { AUTH_INTERCEPTOR_PROVIDER } from './auth'
import { RestExtractor, RestService } from './rest' import { RestExtractor, RestService } from './rest'

View File

@ -4,7 +4,7 @@ import 'rxjs/add/operator/catch'
import 'rxjs/add/operator/map' import 'rxjs/add/operator/map'
import { Observable } from 'rxjs/Observable' import { Observable } from 'rxjs/Observable'
import { SortMeta } from 'primeng/primeng' import { SortMeta } from 'primeng/components/common/sortmeta'
import { AuthService } from '../core' import { AuthService } from '../core'
import { RestExtractor, RestPagination, RestService } from '../rest' import { RestExtractor, RestPagination, RestService } from '../rest'