blob: fac998b15e81a587907e4c7950ab7d74c73f9599 [file] [log] [blame]
Matteo Scandolod819c922016-12-02 14:06:14 -08001const webpack = require('webpack');
2const conf = require('./gulp.conf');
3const path = require('path');
4
5const HtmlWebpackPlugin = require('html-webpack-plugin');
6const autoprefixer = require('autoprefixer');
7
8module.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 Scandolof6acdbe2016-12-13 10:29:37 -080038 'ng-annotate',
Matteo Scandolod819c922016-12-02 14:06:14 -080039 'ts'
40 ]
41 },
42 {
43 test: /.html$/,
44 loaders: [
45 'html'
46 ]
Matteo Scandolo266907e2016-12-20 13:41:42 -080047 },
48 {
49 test: /\.(png|woff|woff2|eot|ttf|svg|jpg|gif|jpeg)$/,
50 loader: 'url-loader?limit=100000'
Matteo Scandolod819c922016-12-02 14:06:14 -080051 }
52 ]
53 },
54 plugins: [
55 new webpack.optimize.OccurrenceOrderPlugin(),
56 new webpack.NoErrorsPlugin(),
57 new HtmlWebpackPlugin({
58 template: conf.path.src('index.html')
Matteo Scandolof6acdbe2016-12-13 10:29:37 -080059 })
Matteo Scandolod819c922016-12-02 14:06:14 -080060 ],
61 postcss: () => [autoprefixer],
62 debug: true,
63 devtool: 'source-map',
64 output: {
65 path: path.join(process.cwd(), conf.paths.tmp),
66 filename: 'index.js'
67 },
68 resolve: {
69 extensions: [
70 '',
71 '.webpack.js',
72 '.web.js',
73 '.js',
74 '.ts'
75 ]
76 },
77 entry: `./${conf.path.src('index')}`,
78 ts: {
79 configFileName: 'tsconfig.json'
80 },
81 tslint: {
82 configuration: require('../tslint.json')
Matteo Scandolo266907e2016-12-20 13:41:42 -080083 },
84 stats: {
85 colors: true,
86 modules: true,
87 reasons: true,
88 errorDetails: true
Matteo Scandolod819c922016-12-02 14:06:14 -080089 }
90};