const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
entry: {
classView: './src/class_view.js',
packageView: './src/package_view.js',
targetView: './src/target_view.js',
},
output: {
filename: '[name].bundle.js',
},
resolve: {
alias: {
vue: 'vue/dist/vue.js',
},
},
devtool: 'inline-source-map',
devServer: {
hot: true,
port: 8888,
compress: true,
open: ['index.html'],
static: {
directory: path.join(__dirname, 'src'),
},
},
optimization: {
splitChunks: {
chunks: 'all',
},
minimize: false,
},
module: {
rules: [
{
test: /\.vue$/,
include: path.resolve(__dirname, 'src/vue_components'),
use: 'vue-loader',
},
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader'],
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.(png|svg|jpg|gif)$/,
use: 'file-loader',
},
],
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/index.html',
}),
new HtmlWebpackPlugin({
filename: 'class_view.html',
template: './src/class_view.html',
favicon: './src/assets/class_graph_icon.png',
chunks: ['classView'],
}),
new HtmlWebpackPlugin({
filename: 'package_view.html',
template: './src/package_view.html',
favicon: './src/assets/package_graph_icon.png',
chunks: ['packageView'],
}),
new HtmlWebpackPlugin({
filename: 'target_view.html',
template: './src/target_view.html',
favicon: './src/assets/target_graph_icon.png',
chunks: ['targetView'],
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'src/json_graph.txt'),
to: path.resolve(__dirname, 'dist/json_graph.txt'),
},
],
}),
new VueLoaderPlugin(),
],
stats: 'minimal',
};