1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16const path = require('path'); 17const TerserPlugin = require('terser-webpack-plugin'); 18 19module.exports = { 20 devtool: 'inline-source-map', 21 resolve: { 22 extensions: ['.ts', '.js', '.css'], 23 modules: [ 24 'node_modules', 25 'src', 26 'deps_build', 27 __dirname, 28 path.resolve(__dirname, '../../..'), 29 ], 30 }, 31 32 resolveLoader: { 33 modules: ['node_modules', path.resolve(__dirname, 'loaders')], 34 }, 35 36 module: { 37 rules: [ 38 { 39 test: /^((?!test).)*\.ts$/, 40 include: [path.resolve('src')], 41 loader: '@ephesoft/webpack.istanbul.loader', // Must be first loader 42 options: {esModules: true}, 43 enforce: 'post', 44 }, 45 { 46 test: /\.ts$/, 47 use: ['ts-loader', 'angular2-template-loader'], 48 }, 49 { 50 test: /\.html$/, 51 use: ['html-loader'], 52 }, 53 { 54 test: /\.css$/, 55 use: ['style-loader', 'css-loader'], 56 }, 57 { 58 test: /\.s[ac]ss$/i, 59 use: ['style-loader', 'css-loader', 'sass-loader'], 60 }, 61 ], 62 }, 63 64 optimization: { 65 minimizer: [ 66 new TerserPlugin({ 67 terserOptions: { 68 keep_fnames: true, 69 }, 70 }), 71 ], 72 }, 73}; 74