Improve webpack configuration.

This commit is contained in:
Alexis Lahouze 2017-09-03 00:45:06 +02:00
parent 49482eab9f
commit 116b61e509
2 changed files with 13 additions and 19 deletions

View File

@ -4,6 +4,9 @@
"repository": "https://git.lahouze.org/xals/accountant",
"license": "AGPL-1.0",
"devDependencies": {
"@types/requirejs": "^2.1.31",
"angular2-template-loader": "^0.6.2",
"awesome-typescript-loader": "^3.2.3",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.2",

View File

@ -2,6 +2,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const helpers = require('./config/helpers');
module.exports = {
context: path.resolve(__dirname, 'src'),
@ -15,7 +16,7 @@ module.exports = {
},
devtool: 'source-map',
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.html'],
extensions: ['.js', '.ts', '.html'],
},
module: {
rules: [{
@ -37,7 +38,7 @@ module.exports = {
}, {
// Javascript
enforce: 'pre',
test: /\.jsx?$/,
test: /\.js$/,
//include: path.resolve(__dirname, 'src'),
loader: 'eslint-loader',
options: {
@ -60,13 +61,13 @@ module.exports = {
]
},
}, {
test: /\.jsx?$/,
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}, {
// Typescript linting
enforce: 'pre',
test: /\.tsx?$/,
test: /\.ts$/,
loader: 'tslint-loader',
options: {
configuration: {
@ -87,31 +88,21 @@ module.exports = {
formattersDirectory: 'node_modules/tslint/lib/formatters/',
}
}, {
test: /\.tsx?$/,
test: /\.ts$/,
exclude: /node_modules/,
loader: 'ts-loader'
loaders: ['awesome-typescript-loader', 'angular2-template-loader?keepUrl=true']
}, {
test: /\.html$/,
use: [
'ngtemplate-loader?relativeTo=/accountant-ui/src',
'html-loader'
]
}, {
test: /\.less$/,
use: [
'style-loader',
'css-loader',
'less-loader',
]
loader: 'raw-loader'
}, {
test: /\.css$/,
use: [
loaders: [
'style-loader',
'css-loader',
]
}, {
test: /\.scss$/,
use: [
loaders: [
'style-loader',
'css-loader',
'sass-loader',