tainacan/webpack.common.js

110 lines
4.1 KiB
JavaScript
Raw Normal View History

2018-03-27 15:33:44 +00:00
let path = require('path');
2021-03-10 12:20:12 +00:00
const webpack = require('webpack');
const ESLintPlugin = require('eslint-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
module.exports = {
entry: {
tainacan_pages_common_scripts: './src/views/tainacan-pages-common-scripts.js',
tainacan_blocks_common_scripts: './src/views/gutenberg-blocks/tainacan-blocks-common-scripts.js',
tainacan_blocks_category_icon: './src/views/gutenberg-blocks/js/tainacan-blocks-category-icon.js',
block_terms_list: './src/views/gutenberg-blocks/blocks/terms-list/index.js',
block_items_list: './src/views/gutenberg-blocks/blocks/items-list/index.js',
block_dynamic_items_list: './src/views/gutenberg-blocks/blocks/dynamic-items-list/index.js',
block_carousel_items_list: './src/views/gutenberg-blocks/blocks/carousel-items-list/index.js',
block_search_bar: './src/views/gutenberg-blocks/blocks/search-bar/index.js',
block_collections_list: './src/views/gutenberg-blocks/blocks/collections-list/index.js',
block_carousel_collections_list: './src/views/gutenberg-blocks/blocks/carousel-collections-list/index.js',
block_related_items_list: './src/views/gutenberg-blocks/blocks/related-items-list/index.js',
block_facets_list: './src/views/gutenberg-blocks/blocks/facets-list/index.js',
block_item_submission_form: './src/views/gutenberg-blocks/blocks/item-submission-form/index.js',
block_faceted_search: './src/views/gutenberg-blocks/blocks/faceted-search/index.js',
block_carousel_terms_list: './src/views/gutenberg-blocks/blocks/carousel-terms-list/index.js',
block_item_gallery: './src/views/gutenberg-blocks/blocks/item-gallery/index.js'
2018-01-23 14:42:01 +00:00
},
output: {
2020-01-14 16:26:15 +00:00
path: path.resolve(__dirname, './src/assets/js/'),
publicPath: './wp-content/plugins/tainacan/assets/js/',
filename: '[name].js'
},
module: {
rules: [
2018-03-23 13:20:37 +00:00
{
test: /\.vue$/,
exclude: /node_modules/,
loader: 'vue-loader'
},
{
test: /\.js$/,
2020-01-14 17:08:31 +00:00
exclude: /node_modules/,
2018-01-26 14:17:30 +00:00
loader: 'babel-loader',
},
{
2018-11-13 14:05:48 +00:00
test: /\.(png|jpg|jpeg|gif|eot|ttf|otf|woff|woff2|svg|svgz)(\?.+)?$/,
2018-01-26 14:17:30 +00:00
loader: 'file-loader'
2018-01-23 14:42:01 +00:00
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader',
'postcss-loader',
],
},
{
test: /\.s[ac]ss$/,
2020-01-14 17:08:31 +00:00
exclude: /node_modules/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader'
},
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: [path.resolve(__dirname, './src/views/admin/scss/_variables.scss')]
}
}
},
],
}
]
},
resolve: {
fallback: {
fs: false,
net: false,
tls: false
}
2018-03-23 18:44:00 +00:00
},
2018-03-27 15:33:44 +00:00
performance: {
hints: false
2021-03-10 12:20:12 +00:00
},
plugins: [
new webpack.DefinePlugin({
'TAINACAN_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new VueLoaderPlugin({
prettify: false
}),
2021-03-10 12:20:12 +00:00
new webpack.ProvidePlugin({
'PhotoSwipe': 'PhotoSwipe'
}),
new MomentLocalesPlugin({
localesToKeep: ['en', 'en-ca', 'en-nz', 'en-gb', 'es-au', 'el', 'es-in', 'pt-br', 'pt', 'es', 'es-us', 'es-mx', 'es-do', 'fr', 'fr-ch', 'fr-ca', 'sv'],
}),
new ESLintPlugin({
extensions: ['vue'],
exclude: ['/node_modules/']
})
],
stats: {
errorDetails: true,
children: true
}
};