2017-05-28 16:49:00 +00:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const path = require('path');
|
|
|
|
|
2018-11-03 20:46:23 +00:00
|
|
|
// The CKEditor part comes from https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/advanced-setup.html
|
|
|
|
const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' );
|
|
|
|
const { styles } = require( '@ckeditor/ckeditor5-dev-utils' );
|
|
|
|
|
2017-05-28 16:49:00 +00:00
|
|
|
module.exports = {
|
2018-11-03 20:46:23 +00:00
|
|
|
plugins: [
|
|
|
|
new CKEditorWebpackPlugin( {
|
|
|
|
// See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
|
|
|
|
language: 'en'
|
|
|
|
} )
|
|
|
|
],
|
2017-05-28 16:49:00 +00:00
|
|
|
entry: {
|
2018-11-04 10:19:34 +00:00
|
|
|
"root": ['babel-polyfill', './src/root.js'],
|
|
|
|
"mosaico-root": ['babel-polyfill', './src/lib/sandboxed-mosaico-root.js'],
|
|
|
|
"ckeditor-root": ['babel-polyfill', './src/lib/sandboxed-ckeditor-root.js'],
|
2018-11-06 12:30:50 +00:00
|
|
|
"grapesjs-root": ['babel-polyfill', './src/lib/sandboxed-grapesjs-root.js'],
|
2018-11-13 20:35:33 +00:00
|
|
|
"codeeditor-root": ['babel-polyfill', './src/lib/sandboxed-codeeditor-root.js'],
|
2017-05-28 16:49:00 +00:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
library: 'MailtrainReactBody',
|
|
|
|
filename: '[name].js',
|
|
|
|
path: path.resolve(__dirname, 'dist')
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
2017-08-16 14:10:30 +00:00
|
|
|
{
|
|
|
|
test: /\.(js|jsx)$/,
|
2018-11-03 20:46:23 +00:00
|
|
|
exclude: path.join(__dirname, 'node_modules'),
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
presets: [
|
|
|
|
['env', {
|
|
|
|
targets: {
|
|
|
|
"chrome": "58",
|
|
|
|
"edge": "15",
|
|
|
|
"firefox": "55",
|
|
|
|
"ios": "10"
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
'stage-1'
|
|
|
|
],
|
|
|
|
plugins: ['transform-react-jsx', 'transform-decorators-legacy', 'transform-function-bind']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2017-08-16 14:10:30 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2018-11-03 20:46:23 +00:00
|
|
|
use: [
|
|
|
|
{
|
2018-11-06 12:30:50 +00:00
|
|
|
loader: 'style-loader'
|
2018-11-03 20:46:23 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'css-loader'
|
2018-11-06 12:30:50 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /ckeditor5-[^/]+\/theme\/[\w-/]+\.css$/,
|
|
|
|
use: [
|
2018-11-03 20:46:23 +00:00
|
|
|
{
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: styles.getPostCssConfig( {
|
|
|
|
themeImporter: {
|
|
|
|
themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' )
|
|
|
|
},
|
2018-11-06 12:30:50 +00:00
|
|
|
minify: true
|
2018-11-03 20:46:23 +00:00
|
|
|
} )
|
2018-11-04 10:19:34 +00:00
|
|
|
}
|
2018-11-03 20:46:23 +00:00
|
|
|
]
|
2017-08-16 14:10:30 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif)$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 8192 // inline base64 URLs for <=8k images, direct URLs for the rest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-11-03 20:46:23 +00:00
|
|
|
},
|
2017-08-16 14:10:30 +00:00
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
exclude: path.join(__dirname, 'node_modules'),
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
modules: true,
|
|
|
|
localIdentName: '[path][name]__[local]--[hash:base64:5]'
|
|
|
|
}
|
|
|
|
},
|
2018-11-06 12:30:50 +00:00
|
|
|
'sass-loader'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg|ckeditor-insert-image\.svg$/,
|
|
|
|
use: [
|
|
|
|
'raw-loader'
|
|
|
|
]
|
2017-08-16 14:10:30 +00:00
|
|
|
},
|
2018-02-24 20:59:00 +00:00
|
|
|
{
|
2018-11-06 12:30:50 +00:00
|
|
|
test: /\.(svg|otf|woff2|woff|ttf|eot)$/,
|
|
|
|
exclude: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg|ckeditor-insert-image\.svg$/,
|
|
|
|
use: [
|
|
|
|
'url-loader'
|
|
|
|
]
|
2018-02-24 20:59:00 +00:00
|
|
|
}
|
2017-05-28 16:49:00 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
externals: {
|
2017-06-04 11:16:29 +00:00
|
|
|
jquery: 'jQuery',
|
2017-07-08 13:48:34 +00:00
|
|
|
csfrToken: 'csfrToken',
|
|
|
|
mailtrainConfig: 'mailtrainConfig'
|
2017-05-28 16:49:00 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
// new webpack.optimize.UglifyJsPlugin(),
|
|
|
|
new webpack.optimize.CommonsChunkPlugin('common')
|
2017-06-21 00:14:14 +00:00
|
|
|
],
|
|
|
|
watchOptions: {
|
|
|
|
ignored: 'node_modules/',
|
2018-11-06 12:30:50 +00:00
|
|
|
poll: 2000
|
2017-06-21 00:14:14 +00:00
|
|
|
}
|
2017-05-28 16:49:00 +00:00
|
|
|
};
|