Use webpack.
This commit is contained in:
109
webpack.config.js
Normal file
109
webpack.config.js
Normal 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,
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user