| [5e4cb73] | 1 | const webpack = require('webpack');
|
|---|
| 2 | const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|---|
| 3 | const path = require('path');
|
|---|
| 4 | const CopyPlugin = require('copy-webpack-plugin');
|
|---|
| 5 |
|
|---|
| 6 | module.exports = {
|
|---|
| [af54e79] | 7 | entry: { index: path.resolve(__dirname, 'src', 'main.ts') },
|
|---|
| [5e4cb73] | 8 | module: {
|
|---|
| 9 | rules: [
|
|---|
| 10 | {
|
|---|
| 11 | test: /\.ts$/,
|
|---|
| [af54e79] | 12 | use: ['ts-loader', 'angular2-template-loader'],
|
|---|
| [8ba1a11] | 13 | exclude: /node_modules/,
|
|---|
| [5e4cb73] | 14 | },
|
|---|
| 15 | {
|
|---|
| 16 | test: /\.(html|css)$/,
|
|---|
| [af54e79] | 17 | type: 'asset/source',
|
|---|
| [5e4cb73] | 18 | },
|
|---|
| 19 | ]
|
|---|
| 20 | },
|
|---|
| 21 | resolve: {
|
|---|
| 22 | extensions: ['.ts', '.js'],
|
|---|
| 23 | alias: {
|
|---|
| [af54e79] | 24 | '@': path.resolve(__dirname, 'src', 'app/'),
|
|---|
| [5e4cb73] | 25 | }
|
|---|
| 26 | },
|
|---|
| 27 | plugins: [
|
|---|
| 28 | new HtmlWebpackPlugin({
|
|---|
| [af54e79] | 29 | template: path.resolve(__dirname, 'src', 'index.html'),
|
|---|
| [5e4cb73] | 30 | }),
|
|---|
| 31 | new webpack.DefinePlugin({
|
|---|
| 32 | // global app config object
|
|---|
| 33 | config: JSON.stringify({
|
|---|
| 34 | apiUrl: 'http://localhost:4000'
|
|---|
| 35 | })
|
|---|
| 36 | }),
|
|---|
| [8ba1a11] | 37 | new CopyPlugin({
|
|---|
| 38 | patterns: [
|
|---|
| 39 | { from: 'src/css', to: 'css' },
|
|---|
| 40 | { from: '../gnuboat/common/css', to: 'css' },
|
|---|
| 41 | { from: '../gnuboat/common/js', to: 'js' },
|
|---|
| 42 | { from: '../gnuboat/common/lib', to: 'lib' },
|
|---|
| 43 | { from: '../gnuboat/common/resources', to: 'resources' },
|
|---|
| 44 | { from: '../gnuboat/common/icon/gnuboat-256-256-transparent.png', to: 'resources' },
|
|---|
| 45 | { from: '../gnuboat/common/icon/gnuboat-device.svg', to: 'resources' },
|
|---|
| 46 | { from: '../gnuboat/common/icon/gnuboat-gauge.svg', to: 'resources' },
|
|---|
| 47 | { from: '../gnuboat/common/icon/gnuboat-logfile.svg', to: 'resources' },
|
|---|
| 48 | { from: '../gnuboat/common/icon/gnuboat-water.svg', to: 'resources' },
|
|---|
| 49 | ]
|
|---|
| 50 | })
|
|---|
| [5e4cb73] | 51 | ],
|
|---|
| 52 | optimization: {
|
|---|
| 53 | splitChunks: {
|
|---|
| 54 | chunks: 'all',
|
|---|
| 55 | },
|
|---|
| 56 | runtimeChunk: true
|
|---|
| 57 | },
|
|---|
| 58 | devServer: {
|
|---|
| [8ba1a11] | 59 | historyApiFallback: true,
|
|---|
| 60 | compress: false,
|
|---|
| 61 | port: 8081
|
|---|
| [5e4cb73] | 62 | }
|
|---|
| 63 | };
|
|---|