diff --git a/config/webpack.common.js b/config/webpack.common.js index f7ddaf9..972fc49 100644 --- a/config/webpack.common.js +++ b/config/webpack.common.js @@ -1,125 +1,127 @@ +// vim: set tw=80 ts=2 sw=2 sts=2: + var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var helpers = require('./helpers'); module.exports = { - entry: { - 'polyfills': './src/polyfills.ts', - 'vendor': './src/vendor.ts', - 'app': './src/main.ts', - 'styles': './src/main.scss' - }, + entry: { + 'polyfills': './src/polyfills.ts', + 'vendor': './src/vendor.ts', + 'app': './src/main.ts', + 'styles': './src/main.scss' + }, - resolve: { - extensions: ['.ts', '.js'], - }, + resolve: { + extensions: ['.ts', '.js'], + }, - module: { - rules: [{ - enforce: 'pre', - test: /webpack\.config\.js$/, - include: helpers.root('src', 'app'), - loader: 'eslint-loader', - options: { - useEslintrc: false, - emitWarning: true, - emitError: true, - failOnWarning: true, - failOnError: true, - baseConfig: 'webpack', - rules: { - indent: ['error', 4] - }, - }, - }, { - // Javascript - enforce: 'pre', - test: /\.jsx?$/, - include: helpers.root('src', 'app'), - loader: 'eslint-loader', - options: { - useEslintrc: false, - emitWarning: false, - emitError: true, - failOnWarning: false, - failOnError: true, - baseConfig: 'angular', - rules: { - indent: ['error', 4] - }, - plugins: [ - 'angular', - 'html', - 'security', - 'this', - 'jquery', - 'promise' - ] - }, - // }, { - // test: /\.jsx?$/, - // exclude: /node_modules/, - // loader: 'babel-loader' - }, { - test: /\.ts?$/, - //exclude: /node_modules/, - use: [ - { - loader: 'awesome-typescript-loader', - options: { configFileName: helpers.root('src', 'tsconfig.json') } - }, - 'angular2-template-loader' - ] - }, { - test: /\.html$/, - loader: 'html-loader' - }, { - test: /\.less$/, - use: [ - 'style-loader', - 'css-loader', - 'less-loader', - ] - }, { - test: /\.css$/, - exclude: helpers.root('src', 'app'), - loader: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: 'css-loader?sourceMap' - }) - }, { - test: /\.css$/, - include: helpers.root('src', 'app'), - loader: 'raw-loader' - }, { - test: /\.scss$/, - use: [ - 'style-loader', - 'css-loader', - 'sass-loader', - ] - }, { - test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, - loader: 'file-loader?name=assets/[name].[hash].[ext]' - }] - }, + module: { + rules: [{ + enforce: 'pre', + test: /webpack\.config\.js$/, + include: helpers.root('src', 'app'), + loader: 'eslint-loader', + options: { + useEslintrc: false, + emitWarning: true, + emitError: true, + failOnWarning: true, + failOnError: true, + baseConfig: 'webpack', + rules: { + indent: ['error', 4] + }, + }, + }, { + // Javascript + enforce: 'pre', + test: /\.jsx?$/, + include: helpers.root('src', 'app'), + loader: 'eslint-loader', + options: { + useEslintrc: false, + emitWarning: false, + emitError: true, + failOnWarning: false, + failOnError: true, + baseConfig: 'angular', + rules: { + indent: ['error', 4] + }, + plugins: [ + 'angular', + 'html', + 'security', + 'this', + 'jquery', + 'promise' + ] + }, + // }, { + // test: /\.jsx?$/, + // exclude: /node_modules/, + // loader: 'babel-loader' + }, { + test: /\.ts?$/, + //exclude: /node_modules/, + use: [ + { + loader: 'awesome-typescript-loader', + options: { configFileName: helpers.root('src', 'tsconfig.json') } + }, + 'angular2-template-loader' + ] + }, { + test: /\.html$/, + loader: 'html-loader' + }, { + test: /\.less$/, + use: [ + 'style-loader', + 'css-loader', + 'less-loader', + ] + }, { + test: /\.css$/, + exclude: helpers.root('src', 'app'), + loader: ExtractTextPlugin.extract({ + fallback: 'style-loader', + use: 'css-loader?sourceMap' + }) + }, { + test: /\.css$/, + include: helpers.root('src', 'app'), + loader: 'raw-loader' + }, { + test: /\.scss$/, + use: [ + 'style-loader', + 'css-loader', + 'sass-loader', + ] + }, { + test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, + loader: 'file-loader?name=assets/[name].[hash].[ext]' + }] + }, - plugins: [ - // Workaround for angular/angular#11580 - new webpack.ContextReplacementPlugin( - // The (\\|\/) piece accounts for path separators in *nix and Windows - /angular(\\|\/)core(\\|\/)@angular/, - helpers.root('./src'), // location of your src - {} // a map of your routes - ), + plugins: [ + // Workaround for angular/angular#11580 + new webpack.ContextReplacementPlugin( + // The (\\|\/) piece accounts for path separators in *nix and Windows + /angular(\\|\/)core(\\|\/)@angular/, + helpers.root('./src'), // location of your src + {} // a map of your routes + ), - new webpack.optimize.CommonsChunkPlugin({ - name: ['app', 'vendor', 'polyfills'] - }), + new webpack.optimize.CommonsChunkPlugin({ + name: ['app', 'vendor', 'polyfills'] + }), - new HtmlWebpackPlugin({ - template: 'src/index.ejs' - }) - ], + new HtmlWebpackPlugin({ + template: 'src/index.ejs' + }) + ], };