Skip to content

Commit

Permalink
Merge pull request #26 from stoikerty/feature/change-customization-fe…
Browse files Browse the repository at this point in the history
…atures

Feature/change customization features
  • Loading branch information
stoikerty authored Sep 21, 2016
2 parents 7fb7139 + c5f4cab commit aac39c8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="/dev-toolkit-logo.png" alt="universal-dev-toolkit-logo" height='42'><sub><strong>v5.3.1</strong></sub>
<img src="/dev-toolkit-logo.png" alt="universal-dev-toolkit-logo" height='42'><sub><strong>v5.3.2</strong></sub>
</p>
<p align="center">
Jump-start your <code>react</code>-powered Web App.<br/>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dev-toolkit",
"version": "5.3.1",
"version": "5.3.2",
"description": "Javascript development toolkit for power users [ ES6, React, node-sass ]",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion toolkit/_userSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const overrideConfig = requireOrNull(
rootForRequire,
pkg.toolkitSettings.webpackConfigPath ?
pkg.toolkitSettings.webpackConfigPath : 'customWebpackConfig.js'
)) || {};
));
debug('overrideConfig', overrideConfig);

// eslint-disable-next-line global-require
Expand Down
19 changes: 13 additions & 6 deletions toolkit/webpack/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import stats from './config/stats';

import {
PATHS,
env,
currentScript,
vendor,
overrideConfig,
namingConvention,
Expand All @@ -16,9 +18,18 @@ import {
cssHook();
filesHook();

// This is an escape-hatch for overriding the webpack config with your custom one.
// NOTE: There's limited support for using these custom config escape hatches. You're on your own!
const createConfig = (config) => {
const override = overrideConfig && overrideConfig.default ?
overrideConfig.default : overrideConfig;
return typeof override === 'function' ?
override({ config, paths: PATHS, env, currentScript }) : config;
};

// Resulting webpack config
// ---
export default {
export default createConfig({
// The entry and ouput configuration for the bundle(s)
entry: {
app: [PATHS.clientAppEntryPoint],
Expand Down Expand Up @@ -59,8 +70,4 @@ export default {
mkdirp: 'empty',
fileExists: 'empty',
},

// NOTE: There's limited support for using these custom config escape hatches. You're on your own!
// This is an escape-hatch for overriding the webpack config with your custom one.
...(overrideConfig.default ? overrideConfig.default : overrideConfig),
};
});
4 changes: 2 additions & 2 deletions toolkit/webpack/config/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ const productionPlugins = [
];

// TODO: extract out
if (process.env.COMPRESS) {
if (process.env.USE_COMPRESSION_PLUGIN) {
productionPlugins.push(
new CompressionPlugin({
asset: '[path]',
test: new RegExp(process.env.GZIP_UPLOAD_PATTERN),
test: new RegExp(process.env.COMPRESSION_PLUGIN_REGEX),
minRatio: 0,
})
);
Expand Down

0 comments on commit aac39c8

Please sign in to comment.