const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: './src/main.ts', resolve: { extensions: ['.ts', '.js'] }, module: { rules: [ { test: /\.ts$/, use: ['ts-loader', 'angular2-template-loader'] }, { test: /\.(html|css)$/, use: 'raw-loader' } ] }, plugins: [ new HtmlWebpackPlugin({ template: './src/index.html' }), new webpack.DefinePlugin({ // global app config object config: JSON.stringify({ apiUrl: '//' + location.hostname + ':4200' }) }) ], devServer: { historyApiFallback: true } }