accountant-ui/config/webpack.common.js

120 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2017-11-07 22:45:59 +01:00
// vim: set tw=80 ts=2 sw=2 sts=2:
2018-06-09 23:49:46 +02:00
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const helpers = require('./helpers');
2017-11-07 22:41:52 +01:00
module.exports = {
2017-11-07 22:45:59 +01:00
entry: {
'polyfills': './src/polyfills.ts',
'vendor': './src/vendor.ts',
'app': './src/main.ts',
'styles': './src/main.scss'
},
2017-11-07 22:41:52 +01:00
2017-11-07 22:45:59 +01:00
resolve: {
extensions: ['.ts', '.js'],
},
2017-11-07 22:41:52 +01:00
2017-11-07 22:45:59 +01:00
module: {
rules: [{
enforce: 'pre',
test: /webpack\.config\.js$/,
include: helpers.root('src', 'app'),
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: helpers.root('src', 'app'),
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'
}, {
2018-06-09 23:50:49 +02:00
test: /\.ts$/,
2017-11-07 22:45:59 +01:00
use: [
{
loader: 'awesome-typescript-loader',
options: { configFileName: helpers.root('src', 'tsconfig.json') }
},
'angular2-template-loader'
]
}, {
test: /\.html$/,
2018-06-09 23:51:46 +02:00
include: helpers.root('src'),
2017-11-07 22:45:59 +01:00
loader: 'html-loader'
}, {
test: /\.css$/,
2018-06-10 14:21:06 +02:00
//include: helpers.root('src'),
use: [
'style-loader',
'css-loader',
'resolve-url-loader'
]
2017-11-07 22:45:59 +01:00
}, {
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
2018-06-10 14:21:06 +02:00
'resolve-url-loader',
'sass-loader?sourceMap'
2017-11-07 22:45:59 +01:00
]
}, {
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'file-loader?name=assets/[name].[hash].[ext]'
}]
},
2017-11-07 22:41:52 +01:00
2018-06-09 23:54:01 +02:00
optimization: {
splitChunks: {
name: true
}
},
2017-11-07 22:45:59 +01:00
plugins: [
// Workaround for angular/angular#11580
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)@angular/,
helpers.root('./src'), // location of your src
{} // a map of your routes
),
2017-11-07 22:41:52 +01:00
2017-11-07 22:45:59 +01:00
new HtmlWebpackPlugin({
template: 'src/index.ejs'
})
],
2017-11-07 22:41:52 +01:00
};