2018-10-10 08:06:23 +00:00
|
|
|
const path = require('path');
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2018-10-14 10:06:25 +00:00
|
|
|
const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
|
2018-10-14 10:12:15 +00:00
|
|
|
const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
|
2018-10-14 16:45:54 +00:00
|
|
|
const { ProvidePlugin } = require('webpack');
|
2018-10-16 13:21:35 +00:00
|
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
2018-10-10 08:06:23 +00:00
|
|
|
|
2018-10-16 13:21:35 +00:00
|
|
|
const npmPackage = require('./package.json');
|
2018-10-10 08:06:23 +00:00
|
|
|
module.exports = {
|
2018-10-17 05:57:38 +00:00
|
|
|
entry: {
|
|
|
|
vendors: './app/vendors.js',
|
|
|
|
main: './app/__module.js',
|
|
|
|
},
|
2018-10-10 08:06:23 +00:00
|
|
|
output: {
|
2018-10-17 05:57:38 +00:00
|
|
|
filename: '[name].[hash].js',
|
2018-10-10 08:06:23 +00:00
|
|
|
path: path.resolve(__dirname, 'dist/public')
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
2018-10-14 05:21:10 +00:00
|
|
|
'auto-ngtemplate-loader',
|
|
|
|
{
|
|
|
|
// enforce: 'pre',
|
|
|
|
loader: 'eslint-loader'
|
|
|
|
}
|
2018-10-10 08:06:23 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
exclude: path.resolve(__dirname, './app/index.html'),
|
|
|
|
use: [
|
|
|
|
{ loader: 'ngtemplate-loader', options: { relativeTo: __dirname } },
|
|
|
|
{ loader: 'html-loader' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff|woff2|eot|ttf|svg)$/,
|
|
|
|
loader: 'url-loader?limit=100000'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif)$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'file-loader'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2018-10-16 13:21:35 +00:00
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader?sourceMap']
|
2018-10-10 08:06:23 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
mode: 'development',
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
2018-10-14 17:04:30 +00:00
|
|
|
template: './app/index.html',
|
|
|
|
templateParameters: {
|
|
|
|
name: npmPackage.name,
|
|
|
|
author: npmPackage.author
|
|
|
|
}
|
2018-10-14 10:06:25 +00:00
|
|
|
}),
|
2018-10-14 10:12:15 +00:00
|
|
|
new WebpackBuildNotifierPlugin({
|
|
|
|
title: 'My Project Webpack Build',
|
|
|
|
logo: path.resolve('./assets/favicon-32x32.png'),
|
|
|
|
suppressSuccess: true
|
|
|
|
}),
|
2018-10-14 16:45:54 +00:00
|
|
|
new CleanTerminalPlugin(),
|
|
|
|
new ProvidePlugin({
|
|
|
|
$: 'jquery',
|
|
|
|
jQuery: 'jquery',
|
2018-10-14 17:04:30 +00:00
|
|
|
'window.jQuery': 'jquery'
|
2018-10-14 16:45:54 +00:00
|
|
|
// angular: 'angular'
|
2018-10-16 13:21:35 +00:00
|
|
|
}),
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
// Options similar to the same options in webpackOptions.output
|
|
|
|
// both options are optional
|
|
|
|
filename: "[name].css",
|
|
|
|
chunkFilename: "[id].css"
|
2018-10-14 16:45:54 +00:00
|
|
|
})
|
2018-10-10 08:06:23 +00:00
|
|
|
]
|
|
|
|
};
|