2019-04-09 00:21:00 +02:00
|
|
|
'use strict'
|
|
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
|
|
const { VueLoaderPlugin } = require('vue-loader')
|
2020-11-25 15:25:57 +01:00
|
|
|
const ESLintPlugin = require('eslint-webpack-plugin');
|
2021-01-25 22:19:21 +01:00
|
|
|
const ExtraneousFileCleanupPlugin = require('webpack-extraneous-file-cleanup-plugin');
|
2021-05-31 16:04:19 +02:00
|
|
|
const CompressionPlugin = require("compression-webpack-plugin");
|
2019-04-09 00:21:00 +02:00
|
|
|
|
|
|
|
const utils = require('./utils')
|
|
|
|
|
|
|
|
const themePath = 'web/themes/custom/materiotheme'
|
2021-04-05 20:58:54 +02:00
|
|
|
const langPath = 'web/sites/default/files/lang'
|
2019-04-09 00:21:00 +02:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.vue', '.json'],
|
|
|
|
alias: {
|
2019-05-31 15:01:54 +02:00
|
|
|
'vue': 'vue/dist/vue.js',
|
2019-04-09 00:21:00 +02:00
|
|
|
'theme': utils.resolve(themePath),
|
2020-12-07 23:11:31 +01:00
|
|
|
'vuejs': utils.resolve(themePath+'/vuejs'),
|
2020-12-08 15:26:56 +01:00
|
|
|
'assets': utils.resolve(themePath+'/assets'),
|
|
|
|
// locales are exported by strings_i18n_json_export from drupal
|
2021-04-05 20:58:54 +02:00
|
|
|
'locales': utils.resolve(langPath)
|
2019-04-09 00:21:00 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
entry: {
|
|
|
|
'main': utils.resolve(themePath + '/assets/scripts/main.js'),
|
2021-04-05 20:58:54 +02:00
|
|
|
// 'lang-en': utils.resolve(langPath + '/en.json'),
|
2021-01-25 22:19:21 +01:00
|
|
|
'print': utils.resolve(themePath + '/assets/styles/print.scss')
|
2021-04-06 12:31:31 +02:00
|
|
|
// 'mdi': utils.resolve(themePath + '/assets/styles/mdi/scss/materialdesignicons.scss')
|
2019-04-09 00:21:00 +02:00
|
|
|
},
|
|
|
|
output: {
|
2021-04-06 12:31:31 +02:00
|
|
|
publicPath: '/themes/custom/materiotheme/assets/dist/',
|
2019-04-09 00:21:00 +02:00
|
|
|
path: utils.resolve(themePath + '/assets/dist/'),
|
2021-04-06 10:42:49 +02:00
|
|
|
filename: '[name].js',
|
2021-04-06 12:31:31 +02:00
|
|
|
chunkFilename: '[name].bundle.js'
|
2019-04-09 00:21:00 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
2020-11-25 15:25:57 +01:00
|
|
|
// {
|
|
|
|
// test: /\.(js|vue)$/,
|
|
|
|
// loader: 'eslint-loader',
|
|
|
|
// enforce: 'pre',
|
|
|
|
// exclude: /node_modules/,
|
|
|
|
// options: {
|
|
|
|
// emitError: true,
|
|
|
|
// emitWarning: true
|
|
|
|
// }
|
|
|
|
// },
|
2019-04-09 00:21:00 +02:00
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
use: 'vue-loader'
|
|
|
|
},
|
2020-12-08 15:26:56 +01:00
|
|
|
// {
|
|
|
|
// resourceQuery: /blockType=i18n/,
|
|
|
|
// type: 'javascript/auto',
|
|
|
|
// loader: '@kazupon/vue-i18n-loader'
|
|
|
|
// },
|
2021-04-06 12:31:31 +02:00
|
|
|
// {
|
|
|
|
// test: /\.js$/,
|
|
|
|
// use: {
|
|
|
|
// loader: 'babel-loader',
|
|
|
|
// }
|
|
|
|
// },
|
2020-12-10 22:46:27 +01:00
|
|
|
{
|
|
|
|
test: /\.(graphql|gql)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'graphql-tag/loader'
|
2021-03-19 16:06:06 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
|
|
use: {
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
|
|
|
}
|
|
|
|
}
|
2019-04-09 00:21:00 +02:00
|
|
|
}
|
2020-12-10 22:46:27 +01:00
|
|
|
// {
|
|
|
|
// test: /\.graphql?$/,
|
|
|
|
// use: [
|
|
|
|
// {
|
|
|
|
// loader: 'webpack-graphql-loader',
|
|
|
|
// options: {
|
|
|
|
// // validate: true,
|
|
|
|
// // schema: "./path/to/schema.json",
|
|
|
|
// // removeUnusedFragments: true
|
|
|
|
// // etc. See "Loader Options" below
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ]
|
|
|
|
// }
|
2019-04-09 00:21:00 +02:00
|
|
|
// , {
|
|
|
|
// test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
|
|
// use: {
|
|
|
|
// loader: 'url-loader',
|
|
|
|
// options: {
|
|
|
|
// limit: 10000,
|
|
|
|
// name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }, {
|
|
|
|
// test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
|
|
|
// use: {
|
|
|
|
// loader: 'url-loader',
|
|
|
|
// options: {
|
|
|
|
// limit: 10000,
|
|
|
|
// name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
2021-01-25 22:19:21 +01:00
|
|
|
// {
|
|
|
|
// test: /\.css$/,
|
|
|
|
// use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
|
|
// },
|
2019-04-09 00:21:00 +02:00
|
|
|
]
|
|
|
|
},
|
2021-04-06 10:42:49 +02:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
2021-04-06 12:31:31 +02:00
|
|
|
// vsa: {
|
|
|
|
// test: /[\\/]node_modules[\\/](vue-simple-accordion)[\\/]/,
|
|
|
|
// name: 'vsa',
|
|
|
|
// chunks: 'all',
|
|
|
|
// usedExports: true
|
|
|
|
// },
|
2021-04-06 10:42:49 +02:00
|
|
|
vclb: {
|
|
|
|
test: /[\\/]node_modules[\\/](vue-cool-lightbox)[\\/]/,
|
|
|
|
name: 'vclb',
|
|
|
|
chunks: 'all',
|
|
|
|
usedExports: true
|
|
|
|
},
|
2021-04-06 12:31:31 +02:00
|
|
|
// vue_page_article: {
|
|
|
|
// test: /[\\/]web[\\/]themes[\\/]custom[\\/]materiotheme[\\/]vuejs[\\/]components[\\/]Pages[\\/]Article.vue/,
|
|
|
|
// name: 'vue_page_article',
|
|
|
|
// chunks: 'all'
|
|
|
|
// }
|
2021-04-06 10:42:49 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-04-09 00:21:00 +02:00
|
|
|
plugins: [
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: '[name].css'
|
|
|
|
}),
|
2020-11-25 21:39:40 +01:00
|
|
|
new VueLoaderPlugin(),
|
|
|
|
new ESLintPlugin({
|
2020-11-26 22:46:01 +01:00
|
|
|
// fix: true
|
2020-12-07 23:11:31 +01:00
|
|
|
// exclude: ['web/.eslintrc.json']
|
2020-11-25 21:39:40 +01:00
|
|
|
// cache: false,
|
|
|
|
// ignore: true,
|
|
|
|
// useEslintrc: false,
|
2021-01-25 22:19:21 +01:00
|
|
|
}),
|
|
|
|
new ExtraneousFileCleanupPlugin({
|
|
|
|
extensions: ['.js'],
|
|
|
|
paths: [utils.resolve(themePath + '/assets/dist/')],
|
|
|
|
minBytes: 4096
|
2021-04-06 10:42:49 +02:00
|
|
|
}),
|
2021-05-31 16:04:19 +02:00
|
|
|
new CompressionPlugin(),
|
2019-04-09 00:21:00 +02:00
|
|
|
]
|
|
|
|
}
|