Use webpack.

This commit is contained in:
Alexis Lahouze 2017-06-10 15:34:10 +02:00
parent 91a77b776f
commit 28229ea954
2 changed files with 164 additions and 37 deletions

View File

@ -4,42 +4,60 @@
"repository": "https://git.lahouze.org/xals/accountant", "repository": "https://git.lahouze.org/xals/accountant",
"license": "AGPL-1.0", "license": "AGPL-1.0",
"devDependencies": { "devDependencies": {
"connect-logger": "0.0.1", "babel-core": "^6.25.0",
"connect-proxy-layer": "^0.1.2", "babel-eslint": "^7.2.3",
"eslint": "^3.7.1", "babel-loader": "^7.0.0",
"eslint-config-angular": "^0.5.0", "bootstrap-webpack": "^0.0.6",
"eslint-config-google": "~0.6", "css-loader": "^0.28.4",
"eslint-plugin-angular": "^1.4.1", "eslint": "^3.19",
"eslint-plugin-html": "^1.5.3", "eslint-config-angular": "^0.5",
"eslint-plugin-jquery": "^1.0.1", "eslint-config-webpack": "^1.2.3",
"eslint-plugin-promise": "^3.0.0", "eslint-friendly-formatter": "^3.0.0",
"eslint-plugin-security": "^1.2.0", "eslint-loader": "^1.7.1",
"eslint-plugin-this": "^0.1.4", "eslint-plugin-angular": "^2.4",
"grunt": "~1.0", "eslint-plugin-html": "^2.0",
"grunt-bg-shell": "^2.3.1", "eslint-plugin-jquery": "^1.2",
"grunt-contrib-clean": "~1.0", "eslint-plugin-promise": "^3.5",
"grunt-contrib-concat": "~1.0", "eslint-plugin-security": "^1.3",
"grunt-contrib-connect": "~1.0", "eslint-plugin-this": "^0.2",
"grunt-contrib-csslint": "^2.0.0", "extract-text-webpack-plugin": "^2.1.2",
"grunt-contrib-cssmin": "~1.0", "file-loader": "^0.11.2",
"grunt-contrib-less": "^1.4.0", "html-loader": "^0.4.5",
"grunt-contrib-uglify": "~2.0", "html-webpack-plugin": "^2.28.0",
"grunt-contrib-watch": "~1.0", "htmllint-loader": "^1.3.8",
"grunt-copy": "^0.1.0", "imports-loader": "^0.7.1",
"grunt-eslint": "~19.0", "less": "^2.7.2",
"grunt-filerev": "^2.3.1", "less-loader": "^4.0.4",
"grunt-flake8": "^0.1.3", "ngtemplate-loader": "^2.0.0",
"grunt-htmllint": "^0.2.7", "style-loader": "^0.18.2",
"grunt-include-source": "~1.0", "url-loader": "^0.5.8",
"grunt-jsonlint": "^1.1.0", "webpack": "^2.6.1",
"grunt-lesslint": "^3.2.0", "webpack-dev-server": "^2.4.5"
"grunt-newer": "~1.1", },
"grunt-ng-annotate": "~2.0", "dependencies": {
"grunt-shell": "~2.0", "angular": "^1.6",
"grunt-usemin": "^3.1.1", "angular-http-auth": "^1.5",
"grunt-wiredep": "~3.0", "angular-messages": "^1.6",
"load-grunt-configs": "~1.0", "angular-resource": "^1.6",
"load-grunt-tasks": "^3.2.0", "angular-route": "^1.6",
"time-grunt": "^1.3.0" "angular-strap": "^2.3.12",
"angular-ui-bootstrap": "^2.5",
"angular-ui-notification": "^0.3",
"angular-xeditable": "^0.8",
"base64util": "^1.0.2",
"bootbox": "^4.4.0",
"bootstrap": "^3.3.7",
"bootstrap-additions": "^0.3.1",
"font-awesome": "^4.7.0",
"highcharts-ng": "^1.1",
"highstock-release": "^5.0.12",
"jquery": "^3.2",
"meanie-angular-storage": "^1.3.1",
"moment": "^2.18",
"ngbootbox": "^0.2.0"
},
"scripts": {
"build": "webpack --config webpack.config.js",
"dev": "webpack-dev-server --debug --devtool eval --config webpack.config.js --progress --colors --hot --content-base build"
} }
} }

109
webpack.config.js Normal file
View File

@ -0,0 +1,109 @@
/* jshint esversion: 6 */
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, 'accountant-ui'),
entry: './js/app.js',
devtool: 'source-map',
module: {
rules: [{
enforce: 'pre',
test: /webpack\.config\.js$/,
include: path.resolve(__dirname),
loader: 'eslint-loader',
options: {
useEslintrc: false,
formatter: require('eslint-friendly-formatter'),
emitWarning: true,
emitError: true,
failOnWarning: true,
failOnError: true,
baseConfig: 'webpack',
rules: {
indent: ['error', 4]
},
},
}, {
// Javascript
enforce: 'pre',
test: /\.jsx?$/,
include: path.resolve(__dirname, 'accountant-ui'),
exclude: /(node_modules|bootstrap)/,
loader: 'eslint-loader',
options: {
useEslintrc: false,
formatter: require('eslint-friendly-formatter'),
emitWarning: false,
emitError: true,
failOnWarning: false,
failOnError: true,
baseConfig: 'angular',
rules: {
indent: ['error', 4]
},
plugins: [
'angular',
'html',
'security',
'this',
'jquery',
'promise'
]
},
}, {
test: /\.html$/,
exclude: /views/,
enforce: 'pre',
loader: 'htmllint-loader'
}, {
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}, {
test: /\.html$/,
use: [
'ngtemplate-loader?relativeTo=/accountant-ui/accountant-ui',
'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'
}),
],
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,
}
};