Skip to content

Commit

Permalink
Removed webpack json merge plugin in favor of require.context
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgerobles committed Sep 18, 2017
1 parent 71cdf4f commit ac7ec84
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -73,7 +73,6 @@
"lw.svg-curves": "^0.1.0",
"lw.svg-path": "^0.1.0",
"marked": "^0.3.6",
"merge-jsons-webpack-plugin": "^1.0.11",
"npm-run-all": "^4.0.1",
"object-to-string": "^1.0.0",
"poly2tri": "^1.3.5",
Expand Down
2 changes: 1 addition & 1 deletion src/data/lw.machines
7 changes: 6 additions & 1 deletion src/reducers/machine-profiles.js
Expand Up @@ -2,7 +2,12 @@
import omit from 'object.omit'
import {actionTypes} from 'redux-localstorage'

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


export const machineProfiles = (state = MACHINEPROFILES_INITIALSTATE, action, lock=/^\*/gi) => {
switch (action.type) {
Expand Down
16 changes: 0 additions & 16 deletions webpack.config.js
Expand Up @@ -4,8 +4,6 @@ var path = require('path');
var src_path = path.resolve('./src');
var dist_path = path.resolve('./dist');

var MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin")

module.exports = {
context: src_path,
entry: [
Expand Down Expand Up @@ -59,22 +57,8 @@ module.exports = {
]
},
plugins: [
new MergeJsonWebpackPlugin({
"output": {
"groupBy": [
{
"pattern": "./src/data/lw.machines/machines/*.json",
"fileName": "./src/data/machine-profiles.json"
}
]
}
}),
new webpack.WatchIgnorePlugin([
path.resolve('./src/data/machine-profiles.json')
]),
new webpack.ProvidePlugin({$: 'jquery', jQuery: 'jquery'}),
new webpack.HotModuleReplacementPlugin(),

],
devServer: {
contentBase: dist_path,
Expand Down

0 comments on commit ac7ec84

Please sign in to comment.