84 lines
1.5 KiB
JavaScript
84 lines
1.5 KiB
JavaScript
var webpack = require('webpack'),
|
|
_ = require('underscore'),
|
|
baseConfig = {},
|
|
config = [];
|
|
|
|
baseConfig = {
|
|
context: __dirname,
|
|
output: {
|
|
path: './assets/js',
|
|
filename: '[name].js',
|
|
},
|
|
resolve: {
|
|
modulesDirectories: [
|
|
'node_modules',
|
|
'assets/js/src'
|
|
]
|
|
},
|
|
node: {
|
|
fs: 'empty'
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{
|
|
test: /\.jsx$/,
|
|
loader: 'babel-loader'
|
|
}
|
|
]
|
|
}
|
|
};
|
|
|
|
// Admin
|
|
config.push(_.extend({}, baseConfig, {
|
|
name: 'admin',
|
|
entry: {
|
|
vendor: ['handlebars', 'handlebars_helpers'],
|
|
mailpoet: ['mailpoet', 'ajax', 'modal', 'notice'],
|
|
admin: [
|
|
'subscribers/listing.jsx',
|
|
'settings.jsx',
|
|
'subscribers.jsx',
|
|
'newsletters_list.jsx',
|
|
'newsletters_form.jsx'
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),
|
|
],
|
|
externals: {
|
|
'jquery': 'jQuery'
|
|
}
|
|
}));
|
|
|
|
// Public
|
|
config.push(_.extend({}, baseConfig, {
|
|
name: 'public',
|
|
entry: {
|
|
public: ['mailpoet', 'ajax', 'public.js']
|
|
},
|
|
externals: {
|
|
'jquery': 'jQuery'
|
|
}
|
|
}));
|
|
|
|
// Test
|
|
config.push(_.extend({}, baseConfig, {
|
|
name: 'test',
|
|
entry: {
|
|
testAjax: 'testAjax.js',
|
|
},
|
|
output: {
|
|
path: './tests/javascript/testBundles',
|
|
filename: '[name].js',
|
|
},
|
|
resolve: {
|
|
modulesDirectories: [
|
|
'node_modules',
|
|
'assets/js/src',
|
|
'tests/javascript/newsletter_editor'
|
|
]
|
|
}
|
|
}));
|
|
|
|
module.exports = config;
|