Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 1 | const webpack = require('webpack'); |
| 2 | const conf = require('./gulp.conf'); |
| 3 | const path = require('path'); |
| 4 | |
| 5 | const HtmlWebpackPlugin = require('html-webpack-plugin'); |
| 6 | const autoprefixer = require('autoprefixer'); |
| 7 | |
| 8 | module.exports = { |
| 9 | module: { |
| 10 | preLoaders: [ |
| 11 | { |
| 12 | test: /\.ts$/, |
| 13 | exclude: /node_modules/, |
| 14 | loader: 'tslint' |
| 15 | } |
| 16 | ], |
| 17 | |
| 18 | loaders: [ |
| 19 | { |
| 20 | test: /.json$/, |
| 21 | loaders: [ |
| 22 | 'json' |
| 23 | ] |
| 24 | }, |
| 25 | { |
| 26 | test: /\.(css|scss)$/, |
| 27 | loaders: [ |
| 28 | 'style', |
| 29 | 'css', |
| 30 | 'sass', |
| 31 | 'postcss' |
| 32 | ] |
| 33 | }, |
| 34 | { |
| 35 | test: /\.ts$/, |
| 36 | exclude: /node_modules/, |
| 37 | loaders: [ |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 38 | 'ng-annotate', |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 39 | 'ts' |
| 40 | ] |
| 41 | }, |
| 42 | { |
| 43 | test: /.html$/, |
| 44 | loaders: [ |
| 45 | 'html' |
| 46 | ] |
| 47 | } |
| 48 | ] |
| 49 | }, |
| 50 | plugins: [ |
| 51 | new webpack.optimize.OccurrenceOrderPlugin(), |
| 52 | new webpack.NoErrorsPlugin(), |
| 53 | new HtmlWebpackPlugin({ |
| 54 | template: conf.path.src('index.html') |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 55 | }) |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 56 | ], |
| 57 | postcss: () => [autoprefixer], |
| 58 | debug: true, |
| 59 | devtool: 'source-map', |
| 60 | output: { |
| 61 | path: path.join(process.cwd(), conf.paths.tmp), |
| 62 | filename: 'index.js' |
| 63 | }, |
| 64 | resolve: { |
| 65 | extensions: [ |
| 66 | '', |
| 67 | '.webpack.js', |
| 68 | '.web.js', |
| 69 | '.js', |
| 70 | '.ts' |
| 71 | ] |
| 72 | }, |
| 73 | entry: `./${conf.path.src('index')}`, |
| 74 | ts: { |
| 75 | configFileName: 'tsconfig.json' |
| 76 | }, |
| 77 | tslint: { |
| 78 | configuration: require('../tslint.json') |
| 79 | } |
| 80 | }; |