1 /* Copyright 2017 ZTE Corporation.
3 *Licensed under the Apache License, Version 2.0 (the "License");
4 *you may not use this file except in compliance with the License.
5 *You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
16 const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
17 const CopyWebpackPlugin = require('copy-webpack-plugin');
18 const HtmlWebpackPlugin = require('html-webpack-plugin');
19 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
21 const webpack = require('webpack');
22 const helpers = require('./helpers');
23 const path = require('path');
31 'main': './alarm/main.browser.ts',
32 'vendor': './alarm/vendor.ts',
33 'polyfills': './alarm/polyfills.browser.ts'
37 extensions: ['.js', '.ts', '.json'],
47 loader: 'awesome-typescript-loader',
52 loader: 'angular2-template-loader'
55 exclude: [/\.(spec|e2e)\.ts$/]
64 use: ['to-string-loader', 'css-loader?sourceMap'],
65 include: helpers.root('alarm', 'app'),
66 exclude: [helpers.root('alarm/assets'), helpers.root('public')]
71 include: [helpers.root('alarm/app')],
72 exclude: [helpers.root('alarm/index.html')]
77 test: /\.(png|jpe?g|gif|ico|svg)$/,
78 include: [helpers.root('public')
80 use: 'file-loader?name=assets/images/[name].[hash].[ext]'
85 test: /\.(eot|woff2?|svg|ttf)([\?]?.*)$/,
86 include: [helpers.root('public', 'thirdparty')
88 use: 'file-loader?name=assets/fonts/[name].[hash].[ext]'
99 new ContextReplacementPlugin(
100 /angular(\\|\/)core(\\|\/)alarm(\\|\/)linker/,
101 helpers.root('alarm'),
106 new HtmlWebpackPlugin({
107 template: 'alarm/index.html',
110 new webpack.optimize.CommonsChunkPlugin({
111 name: ['main', 'vendor', 'polyfills']