From 6800b1ee2d029ff5afd83002f2c1c801ea9f1858 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 3 Sep 2017 00:45:06 +0200 Subject: [PATCH] Improve webpack configuration. --- package.json | 3 +++ webpack.config.js | 29 ++++++++++------------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 8ebaf00..35939f3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/webpack.config.js b/webpack.config.js index 97ecb18..cf249a7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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',