| [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 = {
|
|---|
| 7 | entry: './src/main.ts',
|
|---|
| 8 | module: {
|
|---|
| 9 | rules: [
|
|---|
| 10 | {
|
|---|
| 11 | test: /\.ts$/,
|
|---|
| 12 | use: ['ts-loader', 'angular2-template-loader'],
|
|---|
| 13 | exclude: /node_modules/
|
|---|
| 14 | },
|
|---|
| 15 | {
|
|---|
| 16 | test: /\.(html|css)$/,
|
|---|
| 17 | loader: 'raw-loader'
|
|---|
| 18 | },
|
|---|
| 19 | ]
|
|---|
| 20 | },
|
|---|
| 21 | resolve: {
|
|---|
| 22 | extensions: ['.ts', '.js'],
|
|---|
| 23 | alias: {
|
|---|
| 24 | '@': path.resolve(__dirname, 'src/app/'),
|
|---|
| 25 | }
|
|---|
| 26 | },
|
|---|
| 27 | plugins: [
|
|---|
| 28 | new HtmlWebpackPlugin({
|
|---|
| 29 | template: './src/index.html',
|
|---|
| 30 | filename: 'index.html',
|
|---|
| 31 | inject: 'body'
|
|---|
| 32 | }),
|
|---|
| 33 | new webpack.DefinePlugin({
|
|---|
| 34 | // global app config object
|
|---|
| 35 | config: JSON.stringify({
|
|---|
| 36 | apiUrl: 'http://localhost:4000'
|
|---|
| 37 | })
|
|---|
| 38 | }),
|
|---|
| 39 | new CopyPlugin([
|
|---|
| 40 | { from: 'src/css', to: 'css' },
|
|---|
| 41 | { from: '../common/css', to: 'css' },
|
|---|
| 42 | { from: '../common/js', to: 'js' },
|
|---|
| 43 | { from: '../common/lib', to: 'lib' },
|
|---|
| 44 | { from: '../common/resources', to: 'resources' },
|
|---|
| [70f328b] | 45 | { from: '../common/icon/gnuboat-256-256-transparent.png', to: 'resources' },
|
|---|
| 46 | { from: '../common/icon/gnuboat-device.svg', to: 'resources' },
|
|---|
| [1c07566] | 47 | { from: '../common/icon/gnuboat-gauge.svg', to: 'resources' },
|
|---|
| 48 | { from: '../common/icon/gnuboat-logfile.svg', to: 'resources' },
|
|---|
| [306f18a] | 49 | { from: '../common/icon/gnuboat-water.svg', to: 'resources' },
|
|---|
| [5d20157] | 50 | { from: '../common/icon/processing.svg', to: 'resources' },
|
|---|
| [306f18a] | 51 | { from: '../common/icon/log-excluded.svg', to: 'resources' },
|
|---|
| 52 | { from: '../common/icon/log-processed.svg', to: 'resources' },
|
|---|
| 53 | { from: '../common/icon/log-queued.svg', to: 'resources' },
|
|---|
| 54 | { from: '../common/icon/log-undefined.svg', to: 'resources' }
|
|---|
| [5e4cb73] | 55 | ])
|
|---|
| 56 | ],
|
|---|
| 57 | optimization: {
|
|---|
| 58 | splitChunks: {
|
|---|
| 59 | chunks: 'all',
|
|---|
| 60 | },
|
|---|
| 61 | runtimeChunk: true
|
|---|
| 62 | },
|
|---|
| 63 | devServer: {
|
|---|
| 64 | historyApiFallback: true
|
|---|
| 65 | }
|
|---|
| 66 | };
|
|---|