Skip to content

Instantly share code, notes, and snippets.

@datakurre
Created May 23, 2018 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save datakurre/4544d27844bd6e4a91c8117b78b05e3e to your computer and use it in GitHub Desktop.
Save datakurre/4544d27844bd6e4a91c8117b78b05e3e to your computer and use it in GitHub Desktop.
Building just a Plone resources JavaScript bundle with webpack
import 'plone-logged-in';
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const path = require('path');
const webpack = require('webpack');
const PlonePlugin = require('plonetheme-webpack-plugin');
const PLONE = new PlonePlugin({
portalUrl: 'http://localhost:8080/Plone',
publicPath: '',
debug: true
});
// Disable CommonsChunk -plugin implicit in PLONE.production config
PLONE.plugins.commonschunk.apply = () => null;
const common = {
entry: './bundle.js',
};
switch(path.basename(process.argv[1])) {
case 'webpack':
module.exports = merge(PLONE.production, common, {
output: {
library: 'plone-logged-in',
libraryTarget: 'umd',
filename: 'bundle-[chunkhash].js',
auxiliaryComment: 'Plone logged-in bundle'
}
});
break;
case 'webpack-dev-server':
module.exports = merge(PLONE.development, common);
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment