2019-01-09 14:38:10 +01:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const webpackManifestPlugin = require('webpack-manifest-plugin');
|
|
|
|
const webpackCleanPlugin = require('clean-webpack-plugin');
|
|
|
|
const webpackTerserPlugin = require('terser-webpack-plugin');
|
2019-05-22 14:58:41 +02:00
|
|
|
const webpackCopyPlugin = require('copy-webpack-plugin');
|
2019-01-09 14:38:10 +01:00
|
|
|
const path = require('path');
|
|
|
|
const globalPrefix = 'MailPoetLib';
|
|
|
|
const PRODUCTION_ENV = process.env.NODE_ENV === 'production';
|
|
|
|
const manifestSeed = {};
|
2015-08-17 14:23:46 +03:00
|
|
|
|
2017-06-14 22:40:21 -04:00
|
|
|
// Base config
|
2019-01-09 14:38:10 +01:00
|
|
|
const baseConfig = {
|
2019-01-09 09:29:28 +01:00
|
|
|
mode: PRODUCTION_ENV ? 'production' : 'development',
|
2019-02-04 10:18:15 +01:00
|
|
|
devtool: PRODUCTION_ENV ? undefined : 'eval-source-map',
|
2017-06-14 22:40:21 -04:00
|
|
|
cache: true,
|
2015-08-17 14:23:46 +03:00
|
|
|
context: __dirname,
|
2018-06-13 13:33:27 +01:00
|
|
|
watchOptions: {
|
2015-10-21 15:24:51 -04:00
|
|
|
aggregateTimeout: 300,
|
|
|
|
poll: true
|
|
|
|
},
|
2019-01-09 09:29:28 +01:00
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
2019-01-09 11:49:19 +01:00
|
|
|
new webpackTerserPlugin({
|
|
|
|
terserOptions: {
|
2019-01-14 12:49:30 +01:00
|
|
|
// preserve identifier names for easier debugging & support
|
2019-01-09 09:29:28 +01:00
|
|
|
mangle: false,
|
|
|
|
},
|
2019-02-05 15:50:05 +03:00
|
|
|
parallel: false,
|
2019-01-09 09:29:28 +01:00
|
|
|
}),
|
|
|
|
],
|
|
|
|
},
|
2015-08-17 14:23:46 +03:00
|
|
|
output: {
|
2019-01-21 17:28:31 +01:00
|
|
|
path: path.join(__dirname, 'assets/dist/js'),
|
2018-10-02 09:51:34 +02:00
|
|
|
filename: (PRODUCTION_ENV) ? '[name].[hash:8].js' : '[name].js',
|
2019-01-03 20:51:52 +01:00
|
|
|
chunkFilename: (PRODUCTION_ENV) ? '[name].[hash:8].chunk.js' : '[name].chunk.js',
|
|
|
|
jsonpFunction: 'mailpoetJsonp'
|
2015-08-17 14:23:46 +03:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-06-13 13:33:27 +01:00
|
|
|
modules: [
|
2015-08-17 14:23:46 +03:00
|
|
|
'node_modules',
|
2016-02-22 11:44:06 -05:00
|
|
|
'assets/js/src',
|
2015-08-17 14:23:46 +03:00
|
|
|
],
|
|
|
|
alias: {
|
|
|
|
'handlebars': 'handlebars/dist/handlebars.js',
|
2015-08-19 16:26:38 +03:00
|
|
|
'backbone.marionette': 'backbone.marionette/lib/backbone.marionette',
|
2015-08-21 13:24:06 +03:00
|
|
|
'backbone.supermodel$': 'backbone.supermodel/build/backbone.supermodel.js',
|
2016-01-04 17:02:46 +02:00
|
|
|
'sticky-kit': 'vendor/jquery.sticky-kit.js',
|
2015-08-26 18:24:43 +03:00
|
|
|
'interact$': 'interact.js/interact.js',
|
2015-11-05 17:17:54 +02:00
|
|
|
'spectrum$': 'spectrum-colorpicker/spectrum.js',
|
2019-05-22 14:49:02 +03:00
|
|
|
'wp-js-hooks': path.resolve(__dirname, 'assets/js/src/hooks.js'),
|
2017-06-15 18:11:05 +01:00
|
|
|
'blob$': 'blob-tmp/Blob.js',
|
2015-11-13 14:45:25 +02:00
|
|
|
'papaparse': 'papaparse/papaparse.min.js',
|
2016-02-20 18:53:24 -05:00
|
|
|
'html2canvas': 'html2canvas/dist/html2canvas.js',
|
2018-11-22 18:05:34 +01:00
|
|
|
'asyncqueue': 'vendor/jquery.asyncqueue.js',
|
|
|
|
'intro.js': 'intro.js/intro.js',
|
2015-08-26 18:24:43 +03:00
|
|
|
},
|
2015-08-17 14:23:46 +03:00
|
|
|
},
|
|
|
|
node: {
|
|
|
|
fs: 'empty'
|
|
|
|
},
|
2017-06-14 22:40:21 -04:00
|
|
|
plugins: [
|
|
|
|
new webpackCleanPlugin([
|
2019-02-04 10:18:15 +01:00
|
|
|
'./assets/dist/js/*',
|
2019-01-09 09:29:28 +01:00
|
|
|
]),
|
2017-06-14 22:40:21 -04:00
|
|
|
],
|
2015-08-17 14:23:46 +03:00
|
|
|
module: {
|
2018-06-13 13:33:27 +01:00
|
|
|
rules: [
|
2015-08-17 14:23:46 +03:00
|
|
|
{
|
2019-02-20 11:20:33 +01:00
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /(node_modules|src\/vendor)/,
|
2018-06-13 10:57:40 +01:00
|
|
|
loader: 'babel-loader',
|
2015-08-21 13:24:06 +03:00
|
|
|
},
|
2015-11-04 11:21:08 +01:00
|
|
|
{
|
|
|
|
test: /form_editor\.js$/,
|
|
|
|
loader: 'expose-loader?WysijaForm',
|
|
|
|
},
|
2015-11-02 19:01:01 +01:00
|
|
|
{
|
|
|
|
include: require.resolve('codemirror'),
|
|
|
|
loader: 'expose-loader?CodeMirror',
|
|
|
|
},
|
2015-08-21 13:24:06 +03:00
|
|
|
{
|
|
|
|
include: require.resolve('backbone'),
|
|
|
|
loader: 'expose-loader?Backbone',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
include: require.resolve('underscore'),
|
|
|
|
loader: 'expose-loader?_',
|
|
|
|
},
|
2018-06-06 15:13:39 +01:00
|
|
|
{
|
|
|
|
include: require.resolve('react-tooltip'),
|
|
|
|
loader: 'expose-loader?' + globalPrefix + '.ReactTooltip',
|
|
|
|
},
|
2017-03-01 14:30:24 +03:00
|
|
|
{
|
|
|
|
include: require.resolve('react'),
|
|
|
|
loader: 'expose-loader?' + globalPrefix + '.React',
|
|
|
|
},
|
2017-09-12 16:30:56 +01:00
|
|
|
{
|
|
|
|
include: require.resolve('react-dom'),
|
|
|
|
loader: 'expose-loader?' + globalPrefix + '.ReactDOM',
|
|
|
|
},
|
2017-04-04 15:37:16 +03:00
|
|
|
{
|
2018-11-14 15:03:28 +01:00
|
|
|
include: require.resolve('react-router-dom'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: 'expose-loader?' + globalPrefix + '.ReactRouter',
|
2017-04-04 15:37:16 +03:00
|
|
|
},
|
|
|
|
{
|
2017-03-01 14:30:24 +03:00
|
|
|
include: require.resolve('react-string-replace'),
|
|
|
|
loader: 'expose-loader?' + globalPrefix + '.ReactStringReplace',
|
|
|
|
},
|
2017-02-28 17:58:04 +03:00
|
|
|
{
|
2019-05-22 14:49:02 +03:00
|
|
|
include: path.resolve(__dirname, 'assets/js/src/hooks.js'),
|
|
|
|
use: 'expose-loader?' + globalPrefix + '.Hooks',
|
2017-02-28 17:58:04 +03:00
|
|
|
},
|
2017-04-04 15:37:16 +03:00
|
|
|
{
|
|
|
|
test: /listing.jsx/i,
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.Listing',
|
|
|
|
'babel-loader'
|
|
|
|
],
|
2017-04-04 15:37:16 +03:00
|
|
|
},
|
2017-09-12 16:30:56 +01:00
|
|
|
{
|
|
|
|
test: /form.jsx/i,
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.Form',
|
|
|
|
'babel-loader'
|
|
|
|
]
|
2017-09-12 16:30:56 +01:00
|
|
|
},
|
2018-03-29 16:22:08 -04:00
|
|
|
{
|
2019-06-21 15:33:03 +01:00
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/listings/utils.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
2019-06-21 15:33:03 +01:00
|
|
|
'expose-loader?' + globalPrefix + '.NewslettersListingsUtils',
|
2018-06-13 13:33:27 +01:00
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-03-29 16:22:08 -04:00
|
|
|
},
|
2019-06-21 16:53:06 +01:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/listings/statistics.jsx'),
|
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.NewslettersListingsStatistics',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
|
|
|
},
|
2018-03-29 16:22:08 -04:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/listings/tabs.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.NewslettersListingsTabs',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-03-29 16:22:08 -04:00
|
|
|
},
|
2018-06-29 11:54:16 +02:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/listings/heading.jsx'),
|
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.NewslettersListingsHeading',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
|
|
|
},
|
2018-12-05 18:02:30 +03:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/announcements/feature_announcement.jsx'),
|
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.FeatureAnnouncement',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
|
|
|
},
|
2018-01-31 18:08:43 -05:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/form/fields/selection.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.FormFieldSelection',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-01-31 18:08:43 -05:00
|
|
|
},
|
2018-02-11 22:20:49 -05:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/form/fields/text.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.FormFieldText',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-02-11 22:20:49 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/scheduling/common.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.NewsletterSchedulingCommonOptions',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-02-11 22:20:49 -05:00
|
|
|
},
|
2017-04-12 19:52:29 +03:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/badges/stats.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.StatsBadge',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2017-04-12 19:52:29 +03:00
|
|
|
},
|
2017-05-17 21:45:04 -04:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/breadcrumb.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.NewsletterCreationBreadcrumb',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2017-05-17 21:45:04 -04:00
|
|
|
},
|
2018-02-07 22:19:26 -05:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/types/automatic_emails/events_list.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.AutomaticEmailEventsList',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-02-07 22:19:26 -05:00
|
|
|
},
|
2019-05-15 15:09:14 +02:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/help-tooltip.jsx'),
|
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.HelpTooltip',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
|
|
|
},
|
2018-02-07 22:19:26 -05:00
|
|
|
{
|
|
|
|
include: path.resolve(__dirname, 'assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.AutomaticEmailsBreadcrumb',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-02-07 22:19:26 -05:00
|
|
|
},
|
2015-11-05 17:17:54 +02:00
|
|
|
{
|
|
|
|
include: /Blob.js$/,
|
|
|
|
loader: 'exports-loader?window.Blob',
|
|
|
|
},
|
2015-08-21 13:24:06 +03:00
|
|
|
{
|
2015-09-09 14:05:34 +03:00
|
|
|
test: /backbone.supermodel/,
|
|
|
|
loader: 'exports-loader?Backbone.SuperModel',
|
2015-08-21 13:24:06 +03:00
|
|
|
},
|
2015-08-26 18:24:43 +03:00
|
|
|
{
|
|
|
|
include: require.resolve('handlebars'),
|
|
|
|
loader: 'expose-loader?Handlebars',
|
|
|
|
},
|
2015-11-24 16:50:57 +02:00
|
|
|
{
|
|
|
|
include: /html2canvas.js$/,
|
|
|
|
loader: 'expose-loader?html2canvas',
|
2016-01-05 15:01:30 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
include: require.resolve('velocity-animate'),
|
|
|
|
loader: 'imports-loader?jQuery=jquery',
|
|
|
|
},
|
2018-03-29 16:22:08 -04:00
|
|
|
{
|
|
|
|
include: require.resolve('classnames'),
|
2018-06-13 13:33:27 +01:00
|
|
|
use: [
|
|
|
|
'expose-loader?' + globalPrefix + '.ClassNames',
|
|
|
|
'babel-loader',
|
|
|
|
]
|
2018-03-29 16:22:08 -04:00
|
|
|
},
|
2015-08-17 14:23:46 +03:00
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-06-14 22:40:21 -04:00
|
|
|
// Admin config
|
2019-01-09 14:38:10 +01:00
|
|
|
const adminConfig = {
|
2015-08-17 14:23:46 +03:00
|
|
|
name: 'admin',
|
|
|
|
entry: {
|
2018-11-26 15:01:10 +01:00
|
|
|
vendor: 'webpack_vendor_index.jsx',
|
|
|
|
mailpoet: 'webpack_mailpoet_index.jsx',
|
2018-12-11 12:11:39 +01:00
|
|
|
admin_vendor: [
|
|
|
|
'react',
|
|
|
|
'react-dom',
|
|
|
|
require.resolve('react-router-dom'),
|
|
|
|
'react-string-replace',
|
|
|
|
'prop-types',
|
|
|
|
'classnames',
|
2019-05-15 15:09:14 +02:00
|
|
|
'help-tooltip.jsx',
|
2018-12-11 12:11:39 +01:00
|
|
|
'form/form.jsx',
|
|
|
|
'listing/listing.jsx',
|
|
|
|
'newsletters/badges/stats.jsx',
|
|
|
|
'newsletters/breadcrumb.jsx',
|
|
|
|
'newsletters/listings/tabs.jsx',
|
2019-06-21 15:33:03 +01:00
|
|
|
'newsletters/listings/utils.jsx',
|
2019-06-21 16:53:06 +01:00
|
|
|
'newsletters/listings/statistics.jsx',
|
2018-12-11 12:11:39 +01:00
|
|
|
'newsletters/listings/heading.jsx',
|
2018-12-05 18:02:30 +03:00
|
|
|
'announcements/feature_announcement.jsx',
|
2019-05-15 14:31:59 +02:00
|
|
|
'announcements/free_plan_announcement.jsx',
|
2018-12-11 12:11:39 +01:00
|
|
|
'newsletters/types/automatic_emails/events_list.jsx',
|
|
|
|
'newsletters/types/automatic_emails/breadcrumb.jsx',
|
|
|
|
'newsletters/types/welcome/scheduling.jsx',
|
|
|
|
],
|
2018-11-26 15:01:10 +01:00
|
|
|
admin: 'webpack_admin_index.jsx',
|
|
|
|
form_editor: 'form_editor/webpack_index.jsx',
|
|
|
|
newsletter_editor: 'newsletter_editor/webpack_index.jsx',
|
2015-08-17 14:23:46 +03:00
|
|
|
},
|
2019-05-22 14:58:41 +02:00
|
|
|
plugins: [
|
|
|
|
...baseConfig.plugins,
|
|
|
|
|
|
|
|
new webpackCopyPlugin([
|
|
|
|
{
|
|
|
|
from: 'node_modules/tinymce/skins/lightgray',
|
|
|
|
to: 'skins/lightgray'
|
|
|
|
},
|
|
|
|
])
|
|
|
|
],
|
2019-01-09 09:29:28 +01:00
|
|
|
optimization: {
|
|
|
|
runtimeChunk: {
|
2017-06-14 22:40:21 -04:00
|
|
|
name: 'vendor',
|
2019-01-09 09:29:28 +01:00
|
|
|
},
|
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
|
|
|
chunks: 'all',
|
|
|
|
default: false,
|
|
|
|
vendors: false,
|
|
|
|
vendor: {
|
|
|
|
name: 'vendor',
|
|
|
|
chunks: (chunk) => chunk.name === 'vendor',
|
|
|
|
priority: 1,
|
|
|
|
enforce: true,
|
|
|
|
},
|
2019-01-10 16:35:26 +01:00
|
|
|
admin_vendor_chunk: {
|
|
|
|
name: 'admin_vendor_chunk',
|
|
|
|
test: (module, chunks) => {
|
|
|
|
// add all modules from 'admin_vendor' entrypoint
|
|
|
|
if (chunks.some((chunk) => chunk.name === 'admin_vendor')) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// add admin/form_editor/newsletter_editor shared modules
|
|
|
|
const filteredChunks = chunks.filter((chunk) => {
|
|
|
|
return ['admin', 'form_editor', 'newsletter_editor'].includes(chunk.name);
|
|
|
|
});
|
|
|
|
return filteredChunks.length > 1;
|
|
|
|
},
|
|
|
|
enforce: true,
|
2019-01-09 09:29:28 +01:00
|
|
|
chunks: (chunk) => ['admin_vendor', 'admin', 'form_editor', 'newsletter_editor'].includes(chunk.name),
|
|
|
|
priority: 0,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-08-17 14:23:46 +03:00
|
|
|
externals: {
|
2015-08-25 14:48:04 +03:00
|
|
|
'jquery': 'jQuery',
|
2015-08-17 14:23:46 +03:00
|
|
|
}
|
2017-06-14 22:40:21 -04:00
|
|
|
};
|
2015-08-17 14:23:46 +03:00
|
|
|
|
2017-06-14 22:40:21 -04:00
|
|
|
// Public config
|
2019-01-09 14:38:10 +01:00
|
|
|
const publicConfig = {
|
2015-08-17 14:23:46 +03:00
|
|
|
name: 'public',
|
|
|
|
entry: {
|
2018-11-26 15:01:10 +01:00
|
|
|
public: 'webpack_public_index.jsx',
|
2015-08-17 14:23:46 +03:00
|
|
|
},
|
2018-11-28 14:06:02 +01:00
|
|
|
plugins: [
|
2018-12-03 15:44:35 +01:00
|
|
|
...baseConfig.plugins,
|
|
|
|
|
2018-11-28 14:06:02 +01:00
|
|
|
// replace MailPoet definition with a smaller version for public
|
|
|
|
new webpack.NormalModuleReplacementPlugin(
|
|
|
|
/mailpoet\.js/,
|
|
|
|
'./mailpoet_public.js'
|
|
|
|
),
|
|
|
|
],
|
2015-08-17 14:23:46 +03:00
|
|
|
externals: {
|
|
|
|
'jquery': 'jQuery'
|
|
|
|
}
|
2017-06-14 22:40:21 -04:00
|
|
|
};
|
2015-08-17 14:23:46 +03:00
|
|
|
|
2017-06-14 22:40:21 -04:00
|
|
|
// Migrator config
|
2019-01-09 14:38:10 +01:00
|
|
|
const migratorConfig = {
|
2017-04-18 19:15:12 +02:00
|
|
|
name: 'mp2migrator',
|
|
|
|
entry: {
|
|
|
|
mp2migrator: [
|
|
|
|
'mp2migrator.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
externals: {
|
2017-05-17 17:35:42 +02:00
|
|
|
'jquery': 'jQuery',
|
|
|
|
'mailpoet': 'MailPoet'
|
2017-04-18 19:15:12 +02:00
|
|
|
}
|
2017-06-14 22:40:21 -04:00
|
|
|
};
|
2019-01-09 09:29:28 +01:00
|
|
|
|
2017-06-14 22:40:21 -04:00
|
|
|
// Test config
|
2019-01-09 14:38:10 +01:00
|
|
|
const testConfig = {
|
2015-08-17 14:23:46 +03:00
|
|
|
name: 'test',
|
|
|
|
entry: {
|
2018-11-26 15:01:10 +01:00
|
|
|
vendor: 'webpack_vendor_index.jsx',
|
2015-08-26 18:24:43 +03:00
|
|
|
testNewsletterEditor: [
|
2018-11-26 15:01:10 +01:00
|
|
|
'webpack_mailpoet_index.jsx',
|
|
|
|
'newsletter_editor/webpack_index.jsx',
|
2015-08-26 18:24:43 +03:00
|
|
|
|
|
|
|
'components/config.spec.js',
|
|
|
|
'components/content.spec.js',
|
|
|
|
'components/heading.spec.js',
|
2019-05-28 12:46:05 +02:00
|
|
|
'components/history.spec.js',
|
2015-08-26 18:24:43 +03:00
|
|
|
'components/save.spec.js',
|
|
|
|
'components/sidebar.spec.js',
|
|
|
|
'components/styles.spec.js',
|
2015-12-16 18:06:28 +02:00
|
|
|
'components/communication.spec.js',
|
2015-08-26 18:24:43 +03:00
|
|
|
|
2019-02-27 18:07:35 +01:00
|
|
|
'blocks/automatedLatestContentLayout.spec.js',
|
2015-08-26 18:24:43 +03:00
|
|
|
'blocks/button.spec.js',
|
|
|
|
'blocks/container.spec.js',
|
|
|
|
'blocks/divider.spec.js',
|
|
|
|
'blocks/footer.spec.js',
|
|
|
|
'blocks/header.spec.js',
|
|
|
|
'blocks/image.spec.js',
|
|
|
|
'blocks/posts.spec.js',
|
2019-04-08 16:11:02 +02:00
|
|
|
'blocks/products.spec.js',
|
2015-08-26 18:24:43 +03:00
|
|
|
'blocks/social.spec.js',
|
|
|
|
'blocks/spacer.spec.js',
|
|
|
|
'blocks/text.spec.js',
|
|
|
|
],
|
2015-08-17 14:23:46 +03:00
|
|
|
},
|
|
|
|
output: {
|
2018-06-13 13:33:27 +01:00
|
|
|
path: path.join(__dirname, 'tests/javascript/testBundles'),
|
2015-08-17 14:23:46 +03:00
|
|
|
filename: '[name].js',
|
|
|
|
},
|
2018-11-28 14:06:02 +01:00
|
|
|
plugins: [
|
2018-12-03 15:44:35 +01:00
|
|
|
...baseConfig.plugins,
|
|
|
|
|
2018-11-28 14:06:02 +01:00
|
|
|
// replace MailPoet definition with a smaller version for public
|
|
|
|
new webpack.NormalModuleReplacementPlugin(
|
|
|
|
/mailpoet\.js/,
|
|
|
|
'./mailpoet_tests.js'
|
|
|
|
),
|
|
|
|
],
|
2015-08-17 14:23:46 +03:00
|
|
|
resolve: {
|
2018-06-13 13:33:27 +01:00
|
|
|
modules: [
|
2015-08-17 14:23:46 +03:00
|
|
|
'node_modules',
|
|
|
|
'assets/js/src',
|
|
|
|
'tests/javascript/newsletter_editor'
|
2015-08-26 18:24:43 +03:00
|
|
|
],
|
|
|
|
alias: {
|
2016-01-04 17:02:46 +02:00
|
|
|
'sticky-kit': 'vendor/jquery.sticky-kit.js',
|
2015-08-26 18:24:43 +03:00
|
|
|
'backbone.marionette': 'backbone.marionette/lib/backbone.marionette',
|
|
|
|
'backbone.supermodel$': 'backbone.supermodel/build/backbone.supermodel.js',
|
2018-11-26 15:01:10 +01:00
|
|
|
'blob$': 'blob-tmp/Blob.js',
|
2019-05-22 14:49:02 +03:00
|
|
|
'wp-js-hooks': path.resolve(__dirname, 'assets/js/src/hooks.js'),
|
2015-08-26 18:24:43 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
externals: {
|
|
|
|
'jquery': 'jQuery',
|
|
|
|
'interact': 'interact',
|
|
|
|
'spectrum': 'spectrum',
|
2015-08-17 14:23:46 +03:00
|
|
|
}
|
2017-06-14 22:40:21 -04:00
|
|
|
};
|
2015-08-17 14:23:46 +03:00
|
|
|
|
2019-01-09 14:35:20 +01:00
|
|
|
module.exports = [adminConfig, publicConfig, migratorConfig, testConfig].map((config) => {
|
2017-06-14 22:40:21 -04:00
|
|
|
if (config.name !== 'test') {
|
|
|
|
config.plugins = config.plugins || [];
|
|
|
|
config.plugins.push(
|
|
|
|
new webpackManifestPlugin({
|
2019-01-14 12:49:30 +01:00
|
|
|
// create single manifest file for all Webpack configs
|
2019-01-09 09:29:28 +01:00
|
|
|
seed: manifestSeed,
|
2017-06-14 22:40:21 -04:00
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2019-01-09 14:35:20 +01:00
|
|
|
return Object.assign({}, baseConfig, config);
|
2017-08-31 12:02:20 +03:00
|
|
|
});
|