X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fconfig%2Fwebpack.dev.js;h=5e0f36d7f688532b16b632e1f13f31505083dfcc;hb=383bfc8356d444cbed1dab7e5c1b3bb16becfdfd;hp=964ea56a5f73384189308e7c9e2247941b1d6e0e;hpb=4d19d2f10b691650abe030d0dbb52dc7c8a62441;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js index 964ea56a5..5e0f36d7f 100644 --- a/client/config/webpack.dev.js +++ b/client/config/webpack.dev.js @@ -1,10 +1,12 @@ const helpers = require('./helpers') const webpackMerge = require('webpack-merge') // used to merge webpack configs +const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'}) const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev /** * Webpack Plugins */ +const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin') const DefinePlugin = require('webpack/lib/DefinePlugin') const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') @@ -23,13 +25,15 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, { HMR: HMR }) +const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin + /** * Webpack configuration * * See: http://webpack.github.io/docs/configuration.html#cli */ module.exports = function (env) { - return webpackMerge(commonConfig({env: ENV}), { + return webpackMerge(commonConfig({ env: ENV }), { /** * Developer tool to enhance debugging * @@ -84,6 +88,28 @@ module.exports = function (env) { webtorrent: 'WebTorrent' }, + module: { + + // Too slow, life is short + // rules: [ + // { + // test: /\.ts$/, + // use: [ + // { + // loader: 'tslint-loader', + // options: { + // configFile: 'tslint.json' + // } + // } + // ], + // exclude: [ + // /\.(spec|e2e)\.ts$/, + // /node_modules\// + // ] + // } + // ] + }, + plugins: [ /** @@ -106,6 +132,51 @@ module.exports = function (env) { } }), + new DllBundlesPlugin({ + bundles: { + polyfills: [ + 'core-js', + { + name: 'zone.js', + path: 'zone.js/dist/zone.js' + }, + { + name: 'zone.js', + path: 'zone.js/dist/long-stack-trace-zone.js' + } + ], + vendor: [ + '@angular/platform-browser', + '@angular/platform-browser-dynamic', + '@angular/core', + '@angular/common', + '@angular/forms', + '@angular/http', + '@angular/router', + '@angularclass/hmr', + 'rxjs' + ] + }, + dllDir: helpers.root('dll'), + webpackConfig: webpackMergeDll(commonConfig({env: ENV}), { + devtool: 'cheap-module-source-map', + plugins: [] + }) + }), + + /** + * Plugin: AddAssetHtmlPlugin + * Description: Adds the given JS or CSS file to the files + * Webpack knows about, and put it into the list of assets + * html-webpack-plugin injects into the generated html. + * + * See: https://github.com/SimenB/add-asset-html-webpack-plugin + */ + new AddAssetHtmlPlugin([ + { filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('polyfills')}`) }, + { filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('vendor')}`) } + ]), + /** * Plugin: NamedModulesPlugin (experimental) * Description: Uses file names as module name. @@ -132,6 +203,7 @@ module.exports = function (env) { tslint: { emitErrors: false, failOnHint: false, + typeCheck: true, resourcePath: 'src' },