var webpack = require('webpack');
//var webpackMerge = require('webpack-merge');
//var ExtractTextPlugin = require('extract-text-webpack-plugin');
//var commonConfig = require('./webpack.common.js');

var helpers = require('./helpers');

const SETTINGS = {
    API_URL: 'http://localhost:52281/v1',
    API_IDENTIFIER: "138659EBEBBF408AA1282D46EBDFBDC7"
};

module.exports = {
    devtool: 'inline-source-map',

    resolve: {
        extensions: [ '.ts', '.js']
    },

    module: {
        rules: [
            {
                test: /\.ts$/,
                loaders: ['awesome-typescript-loader', 'angular2-template-loader']
            },
            {
                test: /\.html$/,
                loader: 'html-loader'
            },
            {
                test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
                loader: 'file-loader',               
                options: { name: 'assets/[name].[hash].[ext]',
                }
            },
            {
                test: /\.css$/,
                exclude: helpers.root('src', 'modules'),
                loader: 'null-loader'
            },
            {
                test: /\.css$/,
                include: helpers.root('src', 'modules'),
                loader: 'raw-loader'
            },
            {
                test: /\.scss$/,
                exclude: helpers.root('src', 'modules'),
                loader: 'null-loader'
            },
            {
                test: /\.scss$/,
                include: helpers.root('src', 'modules'),
                use: ['raw-loader','sass-loader']
            }
        ]
    },
    plugins: [
        new webpack.DefinePlugin({
            SETTINGS: JSON.stringify(SETTINGS)
        }),
        new webpack.ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)(@angular|esm5)/, // /angular(\\|\/)core(\\|\/)@angular/,
            helpers.root('src'),
            {}
        )
    ]
}
