Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace merge utility with spread syntax. #97

Merged
merged 1 commit into from
Dec 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import get from 'lodash/get';
import omit from 'lodash/omit';

import mapParentConfig from './mapParentConfig';
import { merge } from './utils';

const webpackMerge = strategy({
entry: 'append',
Expand All @@ -28,7 +27,7 @@ const prepare = config => {
// plugins are ommited by default too.
// It's not ideal, but it's better to let the user make a conscious choice about it.
const props = ['context', 'plugins', 'entry', 'output'];
return merge(omit(config, props), { plugins });
return { ...omit(config, props), plugins };
};

export const _createConfig = cacheDir => (settings, rawParentConfig) => {
Expand Down
12 changes: 7 additions & 5 deletions src/createSettings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import get from 'lodash/get';
import isNil from 'lodash/isNil';
import { merge } from './utils';
import createHash from './createHash';
import normalizeEntry from './normalizeEntry';
import getEnv from './getEnv';
Expand Down Expand Up @@ -31,16 +30,19 @@ export const _createSettings = getEnv => ({ originalSettings, index, parentConfi
config: {},
};

const settings = merge(defaults, otherSettings, {
const settings = {
...defaults,
...otherSettings,
entry: normalizeEntry(entry),
id: getInstanceId(index),
env: getEnv(env),
inherit: isNil(inherit) ? false : inherit,
});
};

return merge(settings, {
return {
...settings,
hash: createHash(settings),
});
};
};

export default _createSettings(getEnv);
4 changes: 2 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RawSource } from 'webpack-sources';
import path from 'path';

import { cacheDir, getManifestPath, getInjectPath } from './paths';
import { concat, merge, keys } from './utils/index.js';
import { concat, keys } from './utils/index.js';
import createCompileIfNeeded from './createCompileIfNeeded';
import createConfig from './createConfig';
import createMemory from './createMemory';
Expand Down Expand Up @@ -103,7 +103,7 @@ class AutoDLLPlugin {
};
}, {});

compilation.assets = merge(compilation.assets, dllAssets);
compilation.assets = { ...compilation.assets, ...dllAssets };

callback();
});
Expand Down
1 change: 0 additions & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { default as safeClone } from './safeClone';
export const concat = Array.prototype.concat.bind([]);
export const merge = (...args) => Object.assign({}, ...args);
export const keys = Object.keys;