accountant-ui/webpack.config.js
2017-07-11 08:49:39 +02:00

120 lines
3.3 KiB
JavaScript

/* jshint esversion: 6 */
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: './app.ts',
devtool: 'source-map',
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.html'],
alias: {
'@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(
__dirname, 'src/scheduler/index.ts')
}
},
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?$/,
//include: path.resolve(__dirname, 'src'),
exclude: /(node_modules|bootstrap)/,
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'
}, {
test: /\.html$/,
use: [
'ngtemplate-loader?relativeTo=/accountant-ui/src',
'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'
}),
new webpack.ProvidePlugin({
"window.jQuery": "jquery"
}),
],
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,
}
};