2018-03-27 15:33:44 +00:00
|
|
|
let path = require('path');
|
|
|
|
let webpack = require('webpack');
|
2018-05-18 15:44:07 +00:00
|
|
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
2019-06-03 19:12:34 +00:00
|
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
2017-12-04 15:37:16 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2018-05-17 18:45:01 +00:00
|
|
|
entry: {
|
|
|
|
user_search: './src/admin/js/theme-main.js',
|
2018-10-01 20:32:32 +00:00
|
|
|
user_admin: './src/admin/js/main.js',
|
2019-07-24 20:02:25 +00:00
|
|
|
|
2019-01-28 19:06:39 +00:00
|
|
|
gutenberg_terms_list: './src/gutenberg-blocks/tainacan-terms/terms-list/index.js',
|
2019-07-24 20:02:25 +00:00
|
|
|
|
2019-03-11 19:34:35 +00:00
|
|
|
gutenberg_items_list: './src/gutenberg-blocks/tainacan-items/items-list/index.js',
|
2019-07-24 20:02:25 +00:00
|
|
|
|
2019-04-25 12:43:30 +00:00
|
|
|
gutenberg_dynamic_items_list: './src/gutenberg-blocks/tainacan-items/dynamic-items-list/index.js',
|
2019-05-03 15:39:53 +00:00
|
|
|
gutenberg_dynamic_items_list_theme: './src/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list-theme.js',
|
2019-07-24 20:02:25 +00:00
|
|
|
|
2019-07-15 18:06:17 +00:00
|
|
|
gutenberg_carousel_items_list: './src/gutenberg-blocks/tainacan-items/carousel-items-list/index.js',
|
|
|
|
gutenberg_carousel_items_list_theme: './src/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list-theme.js',
|
2019-07-24 20:02:25 +00:00
|
|
|
|
|
|
|
gutenberg_search_bar: './src/gutenberg-blocks/tainacan-items/search-bar/index.js',
|
2019-07-26 19:33:48 +00:00
|
|
|
gutenberg_search_bar_script: './src/gutenberg-blocks/tainacan-items/search-bar/search-bar-theme-script.js',
|
2019-07-24 20:02:25 +00:00
|
|
|
|
2019-05-29 16:01:22 +00:00
|
|
|
gutenberg_collections_list: './src/gutenberg-blocks/tainacan-collections/collections-list/index.js',
|
2019-07-24 20:02:25 +00:00
|
|
|
|
2019-08-12 17:52:43 +00:00
|
|
|
gutenberg_carousel_collections_list: './src/gutenberg-blocks/tainacan-collections/carousel-collections-list/index.js',
|
|
|
|
gutenberg_carousel_collections_list_theme: './src/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list-theme.js',
|
2019-08-22 14:48:34 +00:00
|
|
|
|
2019-06-07 13:57:59 +00:00
|
|
|
gutenberg_facets_list: './src/gutenberg-blocks/tainacan-facets/facets-list/index.js',
|
|
|
|
gutenberg_facets_list_theme: './src/gutenberg-blocks/tainacan-facets/facets-list/facets-list-theme.js'
|
2018-01-23 14:42:01 +00:00
|
|
|
},
|
2017-12-04 15:37:16 +00:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, './src/assets/'),
|
|
|
|
publicPath: './src/assets/',
|
2018-01-23 14:42:01 +00:00
|
|
|
filename: '[name]-components.js'
|
2017-12-04 15:37:16 +00:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
2018-03-23 13:20:37 +00:00
|
|
|
{
|
|
|
|
enforce: "pre",
|
|
|
|
test: /\.vue$/,
|
|
|
|
exclude: /node_modules/,
|
2018-03-23 16:18:13 +00:00
|
|
|
loader: "eslint-loader",
|
|
|
|
options: {
|
|
|
|
fix: false,
|
|
|
|
},
|
2018-03-23 13:20:37 +00:00
|
|
|
},
|
2017-12-04 15:37:16 +00:00
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
2018-04-24 18:27:08 +00:00
|
|
|
loader: 'vue-loader'
|
2017-12-04 15:37:16 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
2018-01-26 14:17:30 +00:00
|
|
|
loader: 'babel-loader',
|
2019-06-03 19:12:34 +00:00
|
|
|
exclude: /node_modules/
|
2017-12-04 15:37:16 +00:00
|
|
|
},
|
|
|
|
{
|
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$/,
|
2018-05-18 15:44:07 +00:00
|
|
|
use: [
|
|
|
|
'vue-style-loader',
|
|
|
|
'css-loader',
|
|
|
|
'postcss-loader',
|
|
|
|
],
|
2018-02-22 19:10:10 +00:00
|
|
|
},
|
|
|
|
{
|
2018-05-18 15:44:07 +00:00
|
|
|
test: /\.s[ac]ss$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'style-loader',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'css-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
includePaths: [path.resolve(__dirname, './src/admin/scss/_variables.scss')]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
],
|
2017-12-04 15:37:16 +00:00
|
|
|
}
|
2018-02-22 19:10:10 +00:00
|
|
|
|
2017-12-04 15:37:16 +00:00
|
|
|
]
|
|
|
|
},
|
2018-03-23 18:44:00 +00:00
|
|
|
node: {
|
2018-03-28 18:21:13 +00:00
|
|
|
fs: 'empty',
|
|
|
|
net: 'empty',
|
|
|
|
tls: 'empty'
|
2018-03-23 18:44:00 +00:00
|
|
|
},
|
2018-03-27 15:33:44 +00:00
|
|
|
performance: {
|
|
|
|
hints: false
|
|
|
|
},
|
|
|
|
};
|
2017-12-04 15:37:16 +00:00
|
|
|
|
2018-04-03 17:55:05 +00:00
|
|
|
// Change to true for production mode
|
2018-04-02 18:59:32 +00:00
|
|
|
const production = false;
|
2018-03-29 18:01:05 +00:00
|
|
|
|
|
|
|
if (production === true) {
|
2018-10-23 13:23:09 +00:00
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
2018-04-02 18:59:32 +00:00
|
|
|
|
2018-08-15 19:32:49 +00:00
|
|
|
console.log(`Production: ${production}`);
|
2018-03-29 18:01:05 +00:00
|
|
|
|
2018-04-03 17:55:05 +00:00
|
|
|
module.exports.mode = 'production';
|
|
|
|
|
2018-03-29 18:01:05 +00:00
|
|
|
module.exports.devtool = '';
|
|
|
|
|
2017-12-04 15:37:16 +00:00
|
|
|
module.exports.plugins = (module.exports.plugins || []).concat([
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
2018-03-29 18:01:05 +00:00
|
|
|
NODE_ENV: JSON.stringify('production')
|
2017-12-04 15:37:16 +00:00
|
|
|
}
|
|
|
|
}),
|
2018-10-23 13:23:09 +00:00
|
|
|
new TerserPlugin({
|
2018-03-27 18:58:52 +00:00
|
|
|
parallel: true,
|
2018-03-29 18:01:05 +00:00
|
|
|
sourceMap: false
|
2018-03-27 18:58:52 +00:00
|
|
|
}),
|
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
minimize: true
|
2018-05-18 15:44:07 +00:00
|
|
|
}),
|
|
|
|
new VueLoaderPlugin(),
|
2018-04-02 18:59:32 +00:00
|
|
|
]);
|
2018-03-29 18:01:05 +00:00
|
|
|
|
|
|
|
module.exports.resolve = {
|
|
|
|
alias: {
|
2018-10-18 13:19:57 +00:00
|
|
|
'vue$': 'vue/dist/vue.min',
|
2019-06-03 19:12:34 +00:00
|
|
|
'swiper$': 'swiper/dist/js/swiper.min.js'
|
2018-03-29 18:01:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2018-08-15 19:32:49 +00:00
|
|
|
console.log(`Production: ${production}`);
|
2018-03-29 18:01:05 +00:00
|
|
|
|
|
|
|
module.exports.devtool = '';
|
|
|
|
|
|
|
|
module.exports.plugins = [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: JSON.stringify('development')
|
|
|
|
},
|
|
|
|
}),
|
2018-05-18 15:44:07 +00:00
|
|
|
new VueLoaderPlugin(),
|
2019-06-03 19:12:34 +00:00
|
|
|
new BundleAnalyzerPlugin({
|
|
|
|
openAnalyzer: false,
|
|
|
|
analyzerMode: 'static'
|
|
|
|
})
|
2018-03-29 18:01:05 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
module.exports.resolve = {
|
|
|
|
alias: {
|
|
|
|
//'vue$': 'vue/dist/vue.esm' // uncomment this and comment the above to use vue dev tools (can cause type error)
|
2019-06-03 19:12:34 +00:00
|
|
|
'vue$': 'vue/dist/vue.min',
|
|
|
|
'swiper$': 'swiper/dist/js/swiper.min.js'
|
2018-03-29 18:01:05 +00:00
|
|
|
}
|
2018-03-27 18:58:52 +00:00
|
|
|
}
|
2017-12-04 15:37:16 +00:00
|
|
|
}
|