Skip to content

Commit ac7ec84

Browse files
committed
Removed webpack json merge plugin in favor of require.context
1 parent 71cdf4f commit ac7ec84

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"lw.svg-curves": "^0.1.0",
7474
"lw.svg-path": "^0.1.0",
7575
"marked": "^0.3.6",
76-
"merge-jsons-webpack-plugin": "^1.0.11",
7776
"npm-run-all": "^4.0.1",
7877
"object-to-string": "^1.0.0",
7978
"poly2tri": "^1.3.5",

src/data/lw.machines

src/reducers/machine-profiles.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
import omit from 'object.omit'
33
import {actionTypes} from 'redux-localstorage'
44

5-
export const MACHINEPROFILES_INITIALSTATE = require("../data/machine-profiles.json");
5+
export const MACHINEPROFILES_INITIALSTATE=((ctx)=>{
6+
let keys = ctx.keys();
7+
let values = keys.map(ctx);
8+
return (Object.assign.apply(null,[{},...values]))
9+
})(require.context('../data/lw.machines/machines', true, /\.json$/gi))
10+
611

712
export const machineProfiles = (state = MACHINEPROFILES_INITIALSTATE, action, lock=/^\*/gi) => {
813
switch (action.type) {

webpack.config.js

-16
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ var path = require('path');
44
var src_path = path.resolve('./src');
55
var dist_path = path.resolve('./dist');
66

7-
var MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin")
8-
97
module.exports = {
108
context: src_path,
119
entry: [
@@ -59,22 +57,8 @@ module.exports = {
5957
]
6058
},
6159
plugins: [
62-
new MergeJsonWebpackPlugin({
63-
"output": {
64-
"groupBy": [
65-
{
66-
"pattern": "./src/data/lw.machines/machines/*.json",
67-
"fileName": "./src/data/machine-profiles.json"
68-
}
69-
]
70-
}
71-
}),
72-
new webpack.WatchIgnorePlugin([
73-
path.resolve('./src/data/machine-profiles.json')
74-
]),
7560
new webpack.ProvidePlugin({$: 'jquery', jQuery: 'jquery'}),
7661
new webpack.HotModuleReplacementPlugin(),
77-
7862
],
7963
devServer: {
8064
contentBase: dist_path,

0 commit comments

Comments
 (0)