2017-06-10 15:34:10 +02:00
|
|
|
/* jshint esversion: 6 */
|
|
|
|
const path = require('path');
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2017-07-07 01:16:49 +02:00
|
|
|
const webpack = require('webpack');
|
2017-06-10 15:34:10 +02:00
|
|
|
|
|
|
|
module.exports = {
|
2017-06-10 20:24:51 +02:00
|
|
|
context: path.resolve(__dirname, 'src'),
|
2017-07-24 19:53:24 +02:00
|
|
|
entry: './main.ts',
|
2017-06-10 15:34:10 +02:00
|
|
|
devtool: 'source-map',
|
2017-07-10 15:51:58 +02:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx', '.html'],
|
|
|
|
alias: {
|
2017-07-11 08:49:39 +02:00
|
|
|
'@accountant/accounts': path.resolve(
|
|
|
|
__dirname, 'src/accounts/index.ts'),
|
|
|
|
'@accountant/operations': path.resolve(
|
|
|
|
__dirname, 'src/operations/index.ts'),
|
|
|
|
'@accountant/login': path.resolve(
|
|
|
|
__dirname, 'src/login/index.ts'),
|
|
|
|
'@accountant/scheduler': path.resolve(
|
2017-07-11 18:51:01 +02:00
|
|
|
__dirname, 'src/scheduler/index.ts'),
|
|
|
|
'@angular/upgrade/static': path.resolve(
|
|
|
|
__dirname, 'node_modules/@angular/upgrade/bundles/upgrade-static.umd.js'),
|
2017-07-10 15:51:58 +02:00
|
|
|
}
|
|
|
|
},
|
2017-06-10 15:34:10 +02:00
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
enforce: 'pre',
|
|
|
|
test: /webpack\.config\.js$/,
|
|
|
|
include: path.resolve(__dirname),
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
options: {
|
|
|
|
useEslintrc: false,
|
|
|
|
emitWarning: true,
|
|
|
|
emitError: true,
|
|
|
|
failOnWarning: true,
|
|
|
|
failOnError: true,
|
|
|
|
baseConfig: 'webpack',
|
|
|
|
rules: {
|
|
|
|
indent: ['error', 4]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
// Javascript
|
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.jsx?$/,
|
2017-06-10 20:24:51 +02:00
|
|
|
//include: path.resolve(__dirname, 'src'),
|
2017-06-10 15:34:10 +02:00
|
|
|
loader: 'eslint-loader',
|
|
|
|
options: {
|
|
|
|
useEslintrc: false,
|
|
|
|
emitWarning: false,
|
|
|
|
emitError: true,
|
|
|
|
failOnWarning: false,
|
|
|
|
failOnError: true,
|
|
|
|
baseConfig: 'angular',
|
|
|
|
rules: {
|
|
|
|
indent: ['error', 4]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
'angular',
|
|
|
|
'html',
|
|
|
|
'security',
|
|
|
|
'this',
|
|
|
|
'jquery',
|
|
|
|
'promise'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'babel-loader'
|
2017-07-11 18:51:01 +02:00
|
|
|
}, {
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'ts-loader'
|
2017-06-10 15:34:10 +02:00
|
|
|
}, {
|
|
|
|
test: /\.html$/,
|
|
|
|
use: [
|
2017-06-10 20:24:51 +02:00
|
|
|
'ngtemplate-loader?relativeTo=/accountant-ui/src',
|
2017-06-10 15:34:10 +02:00
|
|
|
'html-loader'
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
test: /\.less$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader',
|
|
|
|
'less-loader',
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader',
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
|
|
|
|
loader: 'url-loader?limit=100000'
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
title: 'Accountant',
|
|
|
|
template: 'index.ejs'
|
|
|
|
}),
|
2017-07-07 01:16:49 +02:00
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
"window.jQuery": "jquery"
|
|
|
|
}),
|
2017-07-11 18:51:01 +02:00
|
|
|
new webpack.ContextReplacementPlugin(
|
|
|
|
/angular(\\|\/)core(\\|\/)@angular/,
|
|
|
|
path.resolve(__dirname, './')
|
|
|
|
)
|
2017-06-10 15:34:10 +02:00
|
|
|
],
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'build'),
|
|
|
|
filename: 'js/bundle.js',
|
|
|
|
//publicPath: 'js'
|
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
proxy: {
|
|
|
|
'/api': {
|
|
|
|
target: 'http://localhost:5000',
|
|
|
|
secure: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
hot: true,
|
|
|
|
noInfo: false,
|
|
|
|
quiet: false,
|
|
|
|
}
|
|
|
|
};
|