accountant-ui/webpack.config.js

153 lines
4.2 KiB
JavaScript
Raw Normal View History

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-09-03 00:45:06 +02:00
const helpers = require('./config/helpers');
2017-06-10 15:34:10 +02:00
module.exports = {
2017-06-10 20:24:51 +02:00
context: path.resolve(__dirname, 'src'),
2017-10-09 08:21:48 +02:00
entry: {
"main": [
'./main.ts'
],
"styles": [
'./main.scss'
]
},
2017-06-10 15:34:10 +02:00
devtool: 'source-map',
2017-07-10 15:51:58 +02:00
resolve: {
2017-09-03 00:45:06 +02:00
extensions: ['.js', '.ts', '.html'],
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',
2017-09-03 00:45:06 +02:00
test: /\.js$/,
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'
]
},
}, {
2017-09-03 00:45:06 +02:00
test: /\.js$/,
2017-06-10 15:34:10 +02:00
exclude: /node_modules/,
loader: 'babel-loader'
2017-08-30 23:13:37 +02:00
}, {
// Typescript linting
enforce: 'pre',
2017-09-03 00:45:06 +02:00
test: /\.ts$/,
2017-08-30 23:13:37 +02:00
loader: 'tslint-loader',
options: {
configuration: {
extends: [
"tslint:latest",
"codelyzer"
],
rules: {
//quotemark: [true, 'single']
}
},
configFile: 'tslint-custom.json',
emitErrors: true,
failOnHint: true,
typeCheck: true,
tsConfigFile: 'tsconfig.json',
formatter: 'verbose',
formattersDirectory: 'node_modules/tslint/lib/formatters/',
}
2017-07-11 18:51:01 +02:00
}, {
2017-09-03 00:45:06 +02:00
test: /\.ts$/,
2017-07-11 18:51:01 +02:00
exclude: /node_modules/,
2017-09-03 00:45:06 +02:00
loaders: ['awesome-typescript-loader', 'angular2-template-loader?keepUrl=true']
2017-06-10 15:34:10 +02:00
}, {
test: /\.html$/,
2017-09-03 00:45:06 +02:00
loader: 'raw-loader'
2017-06-10 15:34:10 +02:00
}, {
test: /\.css$/,
2017-09-03 00:45:06 +02:00
loaders: [
2017-06-10 15:34:10 +02:00
'style-loader',
'css-loader',
]
2017-08-13 15:14:12 +02:00
}, {
test: /\.scss$/,
2017-09-03 00:45:06 +02:00
loaders: [
2017-08-13 15:14:12 +02:00
'style-loader',
'css-loader',
'sass-loader',
2017-08-27 17:44:00 +02:00
'resolve-url-loader',
'sass-loader?sourceMap'
2017-08-13 15:14:12 +02:00
]
2017-06-10 15:34:10 +02:00
}, {
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
}]
},
plugins: [
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-10-09 08:21:48 +02:00
),
new HtmlWebpackPlugin({
title: 'Accountant',
template: 'index.ejs',
hash: false,
inject: true,
compile: true,
minify: false,
chunks: 'all'
})
2017-06-10 15:34:10 +02:00
],
output: {
path: path.resolve(__dirname, 'build'),
2017-10-09 08:21:48 +02:00
filename: '[name].bundle.js',
chunkFilename: '[name].chunk.js'
2017-06-10 15:34:10 +02:00
//publicPath: 'js'
},
devServer: {
proxy: {
'/api': {
target: 'http://localhost:5000',
secure: false
}
},
hot: true,
noInfo: false,
quiet: false,
}
};