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 */
16
17const HtmlWebpackPlugin = require('html-webpack-plugin');
18const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
19
20module.exports = {
21  resolve: {
22    extensions: ['.ts', '.js', '.css'],
23    modules: [
24      __dirname + '/../../../node_modules',
25      __dirname + '/../../../src',
26      __dirname,
27    ],
28  },
29
30  module: {
31    rules: [
32      {
33        test: /\.ts$/,
34        use: ['ts-loader', 'angular2-template-loader'],
35      },
36      {
37        test: /\.html$/,
38        use: ['html-loader'],
39      },
40      {
41        test: /\.css$/,
42        use: ['style-loader', 'css-loader'],
43      },
44      {
45        test: /\.s[ac]ss$/i,
46        use: ['style-loader', 'css-loader', 'sass-loader'],
47      },
48    ],
49  },
50
51  mode: 'development',
52
53  entry: {
54    polyfills: __dirname + '/polyfills.ts',
55    app: __dirname + '/main.ts',
56  },
57
58  output: {
59    path: __dirname + '/../../../dist/remote_tool_mock',
60    publicPath: '/',
61    filename: 'js/[name].[hash].js',
62    chunkFilename: 'js/[name].[id].[hash].chunk.js',
63  },
64
65  devtool: 'source-map',
66
67  plugins: [
68    new HtmlWebpackPlugin({
69      template: __dirname + '/index.html',
70      inject: 'body',
71      inlineSource: '.(css|js)$',
72    }),
73    new HtmlWebpackInlineSourcePlugin(HtmlWebpackPlugin),
74  ],
75};
76