Created
May 23, 2018 18:23
-
-
Save datakurre/4544d27844bd6e4a91c8117b78b05e3e to your computer and use it in GitHub Desktop.
Building just a Plone resources JavaScript bundle with webpack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'plone-logged-in'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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