blob: 7991b97c09289988dbe390d864200b7f454ffffc [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: [
Matteo Scandolo99fface2016-12-21 15:37:23 -080045 'html?' + JSON.stringify({
46 attrs: ["img:src", "img:ng-src"]
47 })
Matteo Scandolod819c922016-12-02 14:06:14 -080048 ]
Matteo Scandolo266907e2016-12-20 13:41:42 -080049 },
50 {
51 test: /\.(png|woff|woff2|eot|ttf|svg|jpg|gif|jpeg)$/,
52 loader: 'url-loader?limit=100000'
Matteo Scandolod819c922016-12-02 14:06:14 -080053 }
54 ]
55 },
56 plugins: [
57 new webpack.optimize.OccurrenceOrderPlugin(),
58 new webpack.NoErrorsPlugin(),
59 new HtmlWebpackPlugin({
60 template: conf.path.src('index.html')
Matteo Scandolof6acdbe2016-12-13 10:29:37 -080061 })
Matteo Scandolod819c922016-12-02 14:06:14 -080062 ],
63 postcss: () => [autoprefixer],
64 debug: true,
65 devtool: 'source-map',
66 output: {
67 path: path.join(process.cwd(), conf.paths.tmp),
68 filename: 'index.js'
69 },
70 resolve: {
71 extensions: [
72 '',
73 '.webpack.js',
74 '.web.js',
75 '.js',
76 '.ts'
77 ]
78 },
79 entry: `./${conf.path.src('index')}`,
80 ts: {
81 configFileName: 'tsconfig.json'
82 },
83 tslint: {
84 configuration: require('../tslint.json')
Matteo Scandolo266907e2016-12-20 13:41:42 -080085 },
86 stats: {
87 colors: true,
88 modules: true,
89 reasons: true,
90 errorDetails: true
Matteo Scandolod819c922016-12-02 14:06:14 -080091 }
92};