From e736cf148d8b6dff0b35984e2a820df2b987f6db Mon Sep 17 00:00:00 2001 From: Vadim Fedorenko Date: Thu, 17 Mar 2016 16:35:01 +0300 Subject: [PATCH 1/4] docs(webpack.config.js): annotated with docs --- webpack.config.js | 191 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 162 insertions(+), 29 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index a283ad4600..1bb1c1de8f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -28,81 +28,209 @@ const METADATA = { /** * Webpack configuration + * + * See: http://webpack.github.io/docs/configuration.html#cli */ module.exports = { - // Static data for index.html + // Static metadata for index.html + // + // See: (custom attribute) metadata: METADATA, - devtool: 'cheap-module-eval-source-map', - // cache: true, + // Switch loaders to debug mode. + // + // See: http://webpack.github.io/docs/configuration.html#debug debug: true, - // devtool: 'eval' // for faster builds use 'eval' + // Developer tool to enhance debugging + // + // See: http://webpack.github.io/docs/configuration.html#devtool + // See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps + devtool: 'cheap-module-eval-source-map', + + // Cache generated modules and chunks to improve performance for multiple incremental builds. + // This is enabled by default in watch mode. + // You can pass false to disable it. + // + // See: http://webpack.github.io/docs/configuration.html#cache + // cache: false, + + // The entry point for the bundle // Our Angular.js app + // + // See: http://webpack.github.io/docs/configuration.html#entry entry: { + 'polyfills': './src/polyfills.ts', 'vendor': './src/vendor.ts', 'main': './src/main.ts' + }, + // Options affecting the resolving of modules. + // + // See: http://webpack.github.io/docs/configuration.html#resolve resolve: { + + // An array of extensions that should be used to resolve modules. + // + // See: http://webpack.github.io/docs/configuration.html#resolve-extensions extensions: ['', '.ts', '.js'] + }, - // Configuration for our build files + // Options affecting the output of the compilation. + // + // See: http://webpack.github.io/docs/configuration.html#output output: { + + // The output directory as absolute path (required). + // + // See: http://webpack.github.io/docs/configuration.html#output-path path: helpers.root('dist'), + + // Specifies the name of each output file on disk. + // IMPORTANT: You must not specify an absolute path here! + // + // See: http://webpack.github.io/docs/configuration.html#output-filename filename: '[name].bundle.js', + + // The filename of the SourceMaps for the JavaScript files. + // They are inside the output.path directory. + // + // See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename sourceMapFilename: '[name].map', + + // The filename of non-entry chunks as relative path + // inside the output.path directory. + // + // See: http://webpack.github.io/docs/configuration.html#output-chunkfilename chunkFilename: '[id].chunk.js' + }, + // Options affecting the normal modules. + // + // See: http://webpack.github.io/docs/configuration.html#module module: { + + // An array of applied pre and post loaders. + // + // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders preLoaders: [ + // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] }, - // TODO(gdi2290): `exclude: [ helpers.root('node_modules/rxjs') ]` fixed with rxjs 5 beta.3 release - { test: /\.js$/, loader: 'source-map-loader', exclude: [ helpers.root('node_modules/rxjs') ] } + + {test: /\.js$/, loader: 'source-map-loader', exclude: [helpers.root('node_modules/rxjs')]} + ], + + // An array of automatically applied loaders. + // + // IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. + // This means they are not resolved relative to the configuration file. + // + // See: http://webpack.github.io/docs/configuration.html#module-loaders loaders: [ - // Support for .ts files. - { test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [ /\.(spec|e2e)\.ts$/ ] }, - // Support for *.json files. - { test: /\.json$/, loader: 'json-loader' }, + // Typescript loader support for .ts and Angular 2 async routes via .async.ts + // + // See: https://github.com/s-panferov/awesome-typescript-loader + {test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [/\.(spec|e2e)\.ts$/]}, + + // Json loader support for *.json files. + // + // See: https://github.com/webpack/json-loader + {test: /\.json$/, loader: 'json-loader'}, - // Support for CSS as raw text - { test: /\.css$/, loader: 'raw-loader' }, + // Raw loader support for *.css files + // Returns file content as string + // + // See: https://github.com/webpack/raw-loader + {test: /\.css$/, loader: 'raw-loader'}, - // Support for .html as raw text - { test: /\.html$/, loader: 'raw-loader', exclude: [ helpers.root('src/index.html') ] } + // Raw loader support for *.html + // Returns file content as string + // + // See: https://github.com/webpack/raw-loader + {test: /\.html$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')]} ] + }, + // Add additional plugins to the compiler. + // + // See: http://webpack.github.io/docs/configuration.html#plugins plugins: [ + + // Plugin: ForkCheckerPlugin + // Description: Do type checking in a separate process, so webpack don't need to wait. + // + // See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse new ForkCheckerPlugin(), + + // Plugin: OccurenceOrderPlugin + // Description: Varies the distribution of the ids to get the smallest id length + // for often used ids. + // + // See: https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin + // See: https://github.com/webpack/docs/wiki/optimization#minimize new webpack.optimize.OccurenceOrderPlugin(true), - new webpack.optimize.CommonsChunkPlugin({ name: ['main', 'vendor', 'polyfills'], minChunks: Infinity }), - // Static assets - new CopyWebpackPlugin([ { from: 'src/assets', to: 'assets' } ]), - // Generating HTML - new HtmlWebpackPlugin({ template: 'src/index.html', chunksSortMode: 'none' }), - // Environment helpers (when adding more properties make sure you include them in custom-typings.d.ts) - new webpack.DefinePlugin({ - 'ENV': JSON.stringify(METADATA.ENV), - 'HMR': HMR - }) - ], - // Other module loader config + // Plugin: CommonsChunkPlugin + // Description: Shares common code between the pages. + // It identifies common modules and put them into a commons chunk. + // + // See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin + // See: https://github.com/webpack/docs/wiki/optimization#multi-page-app + new webpack.optimize.CommonsChunkPlugin({name: ['main', 'vendor', 'polyfills'], minChunks: Infinity}), - // Our Webpack Development Server config + // Plugin: CopyWebpackPlugin + // Description: Copy files and directories in webpack. + // + // Copies project static assets. + // + // See: https://www.npmjs.com/package/copy-webpack-plugin + new CopyWebpackPlugin([{from: 'src/assets', to: 'assets'}]), + + // Plugin: HtmlWebpackPlugin + // Description: Simplifies creation of HTML files to serve your webpack bundles. + // This is especially useful for webpack bundles that include a hash in the filename + // which changes every compilation. + // + // See: https://github.com/ampedandwired/html-webpack-plugin + new HtmlWebpackPlugin({template: 'src/index.html', chunksSortMode: 'none'}), + + // Plugin: DefinePlugin + // Description: Define free variables. + // Useful for having development builds with debug logging or adding global constants. + // + // Environment helpers + // + // See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin + // NOTE: when adding more properties make sure you include them in custom-typings.d.ts + new webpack.DefinePlugin({'ENV': JSON.stringify(METADATA.ENV), 'HMR': HMR}) + + ], + + // Static analysis linter for TypeScript advanced options configuration + // Description: An extensible linter for the TypeScript language. + // + // See: https://github.com/wbuchwalter/tslint-loader tslint: { emitErrors: false, failOnHint: false, - resourcePath: 'src', + resourcePath: 'src' }, + + // Webpack Development Server configuration + // Description: The webpack-dev-server is a little node.js Express server. + // The server emits information about the compilation state to the client, + // which reacts to those events. + // + // See: https://webpack.github.io/docs/webpack-dev-server.html devServer: { port: METADATA.port, host: METADATA.host, @@ -112,6 +240,11 @@ module.exports = { poll: 1000 } }, + + // Include polyfills or mocks for various node stuff + // Description: Node configuration + // + // See: https://webpack.github.io/docs/configuration.html#node node: { global: 'window', process: true, From 577f0ef84bf8a67215f8c590475a8c131e1e7cfc Mon Sep 17 00:00:00 2001 From: Vadim Fedorenko Date: Thu, 17 Mar 2016 16:35:16 +0300 Subject: [PATCH 2/4] docs(webpack.prod.config.js): annotated with docs --- webpack.prod.config.js | 292 ++++++++++++++++++++++++++++++----------- 1 file changed, 218 insertions(+), 74 deletions(-) diff --git a/webpack.prod.config.js b/webpack.prod.config.js index 5966b140bd..6b6ba4c897 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -35,90 +35,155 @@ const METADATA = { }; /** - * Webpack Configuration + * Webpack configuration + * + * See: http://webpack.github.io/docs/configuration.html#cli */ module.exports = { - // Static data for index.html + // Static metadata for index.html + // + // See: (custom attribute) metadata: METADATA, - devtool: 'source-map', + // Switch loaders to debug mode. + // + // See: http://webpack.github.io/docs/configuration.html#debug debug: false, + // Developer tool to enhance debugging + // + // See: http://webpack.github.io/docs/configuration.html#devtool + // See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps + devtool: 'source-map', + + // The entry point for the bundle + // Our Angular.js app + // + // See: http://webpack.github.io/docs/configuration.html#entry entry: { + 'polyfills': './src/polyfills.ts', 'vendor': './src/vendor.ts', 'main': './src/main.ts' + }, - // Config for our build files + // Options affecting the resolving of modules. + // + // See: http://webpack.github.io/docs/configuration.html#resolve + resolve: { + + // An array of extensions that should be used to resolve modules. + // + // See: http://webpack.github.io/docs/configuration.html#resolve-extensions + extensions: ['', '.ts', '.js'] + + }, + + // Options affecting the output of the compilation. + // + // See: http://webpack.github.io/docs/configuration.html#output output: { + + // The output directory as absolute path (required). + // + // See: http://webpack.github.io/docs/configuration.html#output-path path: helpers.root('dist'), + + // Specifies the name of each output file on disk. + // IMPORTANT: You must not specify an absolute path here! + // + // See: http://webpack.github.io/docs/configuration.html#output-filename filename: '[name].[chunkhash].bundle.js', + + // The filename of the SourceMaps for the JavaScript files. + // They are inside the output.path directory. + // + // See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename sourceMapFilename: '[name].[chunkhash].bundle.map', + + // The filename of non-entry chunks as relative path + // inside the output.path directory. + // + // See: http://webpack.github.io/docs/configuration.html#output-chunkfilename chunkFilename: '[id].[chunkhash].chunk.js' - }, - resolve: { - extensions: ['', '.ts', '.js'] }, + // Options affecting the normal modules. + // + // See: http://webpack.github.io/docs/configuration.html#module module: { + + // An array of applied pre and post loaders. + // + // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders preLoaders: [ - { - test: /\.ts$/, - loader: 'tslint-loader', - exclude: [ - helpers.root('node_modules') - ] - }, - { - test: /\.js$/, - loader: 'source-map-loader', - exclude: [ - helpers.root('node_modules/rxjs') - ] - } + + // Tslint loader support for *.ts files + // + // See: https://github.com/wbuchwalter/tslint-loader + {test: /\.ts$/, loader: 'tslint-loader', exclude: [helpers.root('node_modules')]}, + + // Source map loader support for *.js files + // Extracts SourceMaps for source files that as added as sourceMappingURL comment. + // + // See: https://github.com/webpack/source-map-loader + {test: /\.js$/, loader: 'source-map-loader', exclude: [helpers.root('node_modules/rxjs')]} + ], + + // An array of automatically applied loaders. + // + // IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. + // This means they are not resolved relative to the configuration file. + // + // See: http://webpack.github.io/docs/configuration.html#module-loaders loaders: [ - // Support Angular 2 async routes via .async.ts - // Support for .ts files. + + // Typescript loader support for .ts and Angular 2 async routes via .async.ts + // + // See: https://github.com/s-panferov/awesome-typescript-loader { - test: /\.ts$/, - loader: 'awesome-typescript-loader', + test: /\.ts$/, loader: 'awesome-typescript-loader', query: { - // Remove TypeScript helpers to be injected below by DefinePlugin 'compilerOptions': { + + // Remove TypeScript helpers to be injected + // below by DefinePlugin 'removeComments': true + } }, exclude: [ - /\.(spec|e2e)\.ts$/, + /\.(spec|e2e)\.ts$/ ] }, - // Support for *.json files. - { - test: /\.json$/, - loader: 'json-loader', - }, + // Json loader support for *.json files. + // + // See: https://github.com/webpack/json-loader + {test: /\.json$/, loader: 'json-loader'}, - // Support for CSS as raw text - { - test: /\.css$/, - loader: 'raw-loader', - }, + // Raw loader support for *.css files + // Returns file content as string + // + // See: https://github.com/webpack/raw-loader + {test: /\.css$/, loader: 'raw-loader'}, - // Support for .html as raw text - { - test: /\.html$/, - loader: 'raw-loader', - exclude: [ - helpers.root('src/index.html') - ] - } + // Raw loader support for *.html + // Returns file content as string + // + // See: https://github.com/webpack/raw-loader + {test: /\.html$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')]} ], + + // A RegExp or an array of RegExps. Don’t parse files matching. + // With noParse you can exclude big libraries from parsing, but this can break stuff. + // + // See: http://webpack.github.io/docs/configuration.html#module-noparse noParse: [ helpers.root('zone.js', 'dist'), helpers.root('angular2', 'bundles') @@ -126,43 +191,96 @@ module.exports = { }, + // Add additional plugins to the compiler. + // + // See: http://webpack.github.io/docs/configuration.html#plugins plugins: [ + + // Plugin: ForkCheckerPlugin + // Description: Do type checking in a separate process, so webpack don't need to wait. + // + // See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse new ForkCheckerPlugin(), + + // Plugin: WebpackMd5Hash + // Description: Plugin to replace a standard webpack chunkhash with md5. + // + // See: https://www.npmjs.com/package/webpack-md5-hash new WebpackMd5Hash(), + + // Plugin: DedupePlugin + // Description: Prevents the inclusion of duplicate code into your bundle + // and instead applies a copy of the function at runtime. + // + // See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin + // See: https://github.com/webpack/docs/wiki/optimization#deduplication new DedupePlugin(), + + // Plugin: OccurenceOrderPlugin + // Description: Varies the distribution of the ids to get the smallest id length + // for often used ids. + // + // See: https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin + // See: https://github.com/webpack/docs/wiki/optimization#minimize new OccurenceOrderPlugin(true), - new CommonsChunkPlugin({ - name: ['main', 'vendor', 'polyfills'], - minChunks: Infinity - }), - // Static assets - new CopyWebpackPlugin([ - { - from: 'src/assets', - to: 'assets' - } - ]), - // Generating HTML + + // Plugin: CommonsChunkPlugin + // Description: Shares common code between the pages. + // It identifies common modules and put them into a commons chunk. + // + // See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin + // See: https://github.com/webpack/docs/wiki/optimization#multi-page-app + new CommonsChunkPlugin({name: ['main', 'vendor', 'polyfills'], minChunks: Infinity}), + + // Plugin: CopyWebpackPlugin + // Description: Copy files and directories in webpack. + // + // Copies project static assets. + // + // See: https://www.npmjs.com/package/copy-webpack-plugin + new CopyWebpackPlugin([{from: 'src/assets', to: 'assets'}]), + + // Plugin: HtmlWebpackPlugin + // Description: Simplifies creation of HTML files to serve your webpack bundles. + // This is especially useful for webpack bundles that include a hash in the filename + // which changes every compilation. + // + // See: https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({template: 'src/index.html', chunksSortMode: 'none'}), - new DefinePlugin({ - 'ENV': JSON.stringify(METADATA.ENV), - 'HMR': false - }), - new UglifyJsPlugin({ - // To debug prod builds uncomment //debug lines and comment //prod lines + // Plugin: DefinePlugin + // Description: Define free variables. + // Useful for having development builds with debug logging or adding global constants. + // + // Environment helpers + // + // See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin + // NOTE: when adding more properties make sure you include them in custom-typings.d.ts + new DefinePlugin({'ENV': JSON.stringify(METADATA.ENV), 'HMR': false}), + + // Plugin: UglifyJsPlugin + // Description: Minimize all JavaScript output of chunks. + // Loaders are switched into minimizing mode. + // + // See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin + // NOTE: To debug prod builds uncomment //debug lines and comment //prod lines + new UglifyJsPlugin({ // beautify: true, //debug // mangle: false, //debug // dead_code: false, //debug // unused: false, //debug // deadCode: false, //debug - // compress : { screw_ie8 : true, keep_fnames: true, drop_debugger: false, dead_code: false, unused: false, }, // debug + // compress: { + // screw_ie8: true, + // keep_fnames: true, + // drop_debugger: false, + // dead_code: false, + // unused: false + // }, // debug // comments: true, //debug beautify: false,//prod - // Disable mangling because of a bug in angular2 beta.1, beta.2 and beta.3 - // TODO(mastertinner): enable mangling as soon as angular2 beta.4 is out // mangle: { screw_ie8 : true }, //prod mangle: { screw_ie8: true, @@ -218,32 +336,57 @@ module.exports = { }, // prod compress: {screw_ie8: true}, //prod comments: false //prod - }), - // Include uglify in production + + // Plugin: CompressionPlugin + // Description: Prepares compressed versions of assets to serve + // them with Content-Encoding + // + // See: https://github.com/webpack/compression-webpack-plugin new CompressionPlugin({ algorithm: helpers.gzipMaxLevel, regExp: /\.css$|\.html$|\.js$|\.map$/, threshold: 2 * 1024 }) + ], - // Other module loader configuration + + // Static analysis linter for TypeScript advanced options configuration + // Description: An extensible linter for the TypeScript language. + // + // See: https://github.com/wbuchwalter/tslint-loader tslint: { emitErrors: true, failOnHint: true, - resourcePath: 'src', + resourcePath: 'src' }, - // Needed to workaround Angular 2's html syntax => #id [bind] (event) *ngFor + // Html loader advanced options + // + // See: https://github.com/webpack/html-loader#advanced-options + // TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor htmlLoader: { minimize: true, removeAttributeQuotes: false, caseSensitive: true, - customAttrSurround: [ [/#/, /(?:)/], [/\*/, /(?:)/], [/\[?\(?/, /(?:)/] ], - customAttrAssign: [ /\)?\]?=/ ] + customAttrSurround: [[/#/, /(?:)/], [/\*/, /(?:)/], [/\[?\(?/, /(?:)/]], + customAttrAssign: [/\)?\]?=/] }, - // NOTE: Don't use devServer for production + // Webpack Development Server configuration + // Description: The webpack-dev-server is a little node.js Express server. + // The server emits information about the compilation state to the client, + // which reacts to those events. + // + // WARNING: Don't use devServer for production + // devServer: { + // + // }, + + // Include polyfills or mocks for various node stuff + // Description: Node configuration + // + // See: https://webpack.github.io/docs/configuration.html#node node: { global: 'window', process: false, @@ -252,4 +395,5 @@ module.exports = { clearImmediate: false, setImmediate: false } + }; From 5e571386cbed48bc06df8b866354f1f2f352a13d Mon Sep 17 00:00:00 2001 From: Vadim Fedorenko Date: Thu, 17 Mar 2016 16:35:28 +0300 Subject: [PATCH 3/4] docs(webpack.test.config.js): annotated with docs --- webpack.test.config.js | 148 +++++++++++++++++++++++++++++++---------- 1 file changed, 114 insertions(+), 34 deletions(-) diff --git a/webpack.test.config.js b/webpack.test.config.js index 3d3d70c584..c09065331e 100644 --- a/webpack.test.config.js +++ b/webpack.test.config.js @@ -8,8 +8,7 @@ var helpers = require('./helpers'); * Webpack Plugins */ var ProvidePlugin = require('webpack/lib/ProvidePlugin'); -var DefinePlugin = require('webpack/lib/DefinePlugin'); - +var DefinePlugin = require('webpack/lib/DefinePlugin'); /** * Webpack Constants @@ -17,65 +16,150 @@ var DefinePlugin = require('webpack/lib/DefinePlugin'); const ENV = process.env.ENV = process.env.NODE_ENV = 'test'; /** - * Webpack Configuration + * Webpack configuration + * + * See: http://webpack.github.io/docs/configuration.html#cli */ module.exports = { + + // Developer tool to enhance debugging + // + // See: http://webpack.github.io/docs/configuration.html#devtool + // See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps devtool: 'source-map', + + // Options affecting the resolving of modules. + // + // See: http://webpack.github.io/docs/configuration.html#resolve resolve: { + + // An array of extensions that should be used to resolve modules. + // + // See: http://webpack.github.io/docs/configuration.html#resolve-extensions extensions: ['', '.ts', '.js'] + }, + + // Options affecting the normal modules. + // + // See: http://webpack.github.io/docs/configuration.html#module module: { + + // An array of applied pre and post loaders. + // + // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders preLoaders: [ - { - test: /\.ts$/, - loader: 'tslint-loader', - exclude: [ - helpers.root('node_modules') - ] - }, - { - test: /\.js$/, - loader: "source-map-loader", - exclude: [ - helpers.root('node_modules/rxjs') - ] - } + + // Tslint loader support for *.ts files + // + // See: https://github.com/wbuchwalter/tslint-loader + {test: /\.ts$/, loader: 'tslint-loader', exclude: [helpers.root('node_modules')]}, + + // Source map loader support for *.js files + // Extracts SourceMaps for source files that as added as sourceMappingURL comment. + // + // See: https://github.com/webpack/source-map-loader + {test: /\.js$/, loader: "source-map-loader", exclude: [helpers.root('node_modules/rxjs')]} + ], + + // An array of automatically applied loaders. + // + // IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. + // This means they are not resolved relative to the configuration file. + // + // See: http://webpack.github.io/docs/configuration.html#module-loaders loaders: [ + + // Typescript loader support for .ts and Angular 2 async routes via .async.ts + // + // See: https://github.com/s-panferov/awesome-typescript-loader { test: /\.ts$/, loader: 'awesome-typescript-loader', query: { "compilerOptions": { - "removeComments": true, + + // Remove TypeScript helpers to be injected + // below by DefinePlugin + "removeComments": true + } }, - exclude: [ /\.e2e\.ts$/ ] + exclude: [/\.e2e\.ts$/] }, - { test: /\.json$/, loader: 'json-loader', exclude: [ helpers.root('src/index.html') ] }, - { test: /\.html$/, loader: 'raw-loader', exclude: [ helpers.root('src/index.html') ] }, - { test: /\.css$/, loader: 'raw-loader', exclude: [ helpers.root('src/index.html') ] } + + // Json loader support for *.json files. + // + // See: https://github.com/webpack/json-loader + {test: /\.json$/, loader: 'json-loader', exclude: [helpers.root('src/index.html')]}, + + // Raw loader support for *.css files + // Returns file content as string + // + // See: https://github.com/webpack/raw-loader + {test: /\.html$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')]}, + + // Raw loader support for *.html + // Returns file content as string + // + // See: https://github.com/webpack/raw-loader + {test: /\.css$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')]} + ], + + // An array of applied pre and post loaders. + // + // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders postLoaders: [ - // Instrument only testing sources with Istanbul + + // Instruments JS files with Istanbul for subsequent code coverage reporting. + // Instrument only testing sources. + // + // See: https://github.com/deepsweet/istanbul-instrumenter-loader { - test: /\.(js|ts)$/, + test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader', include: helpers.root('src'), - loader: 'istanbul-instrumenter-loader', exclude: [ /\.(e2e|spec)\.ts$/, /node_modules/ ] } + ] }, + + // Add additional plugins to the compiler. + // + // See: http://webpack.github.io/docs/configuration.html#plugins plugins: [ + + // Plugin: DefinePlugin + // Description: Define free variables. + // Useful for having development builds with debug logging or adding global constants. + // // Environment helpers - new DefinePlugin({ - 'ENV': JSON.stringify(ENV), - 'HMR': false - }) + // + // See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin + // NOTE: when adding more properties make sure you include them in custom-typings.d.ts + new DefinePlugin({'ENV': JSON.stringify(ENV), 'HMR': false}) + ], + + // Static analysis linter for TypeScript advanced options configuration + // Description: An extensible linter for the TypeScript language. + // + // See: https://github.com/wbuchwalter/tslint-loader + tslint: { + emitErrors: false, + failOnHint: false, + resourcePath: 'src' + }, + + // Include polyfills or mocks for various node stuff + // Description: Node configuration + // + // See: https://webpack.github.io/docs/configuration.html#node node: { global: 'window', process: false, @@ -83,10 +167,6 @@ module.exports = { module: false, clearImmediate: false, setImmediate: false - }, - tslint: { - emitErrors: false, - failOnHint: false, - resourcePath: 'src', } + }; From d45061c5e5d542c454541ca8e103c1a058b4b57d Mon Sep 17 00:00:00 2001 From: Vadim Fedorenko Date: Thu, 17 Mar 2016 16:44:06 +0300 Subject: [PATCH 4/4] docs(webpack.config.js): missed some docs --- webpack.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index 1bb1c1de8f..5e23f57bf8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -120,8 +120,15 @@ module.exports = { // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders preLoaders: [ + // Tslint loader support for *.ts files + // + // See: https://github.com/wbuchwalter/tslint-loader // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] }, + // Source map loader support for *.js files + // Extracts SourceMaps for source files that as added as sourceMappingURL comment. + // + // See: https://github.com/webpack/source-map-loader {test: /\.js$/, loader: 'source-map-loader', exclude: [helpers.root('node_modules/rxjs')]} ],