Skip to content

Instantly share code, notes, and snippets.

@bfitch
Created June 1, 2017 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfitch/1234d85082146943e35c7d5da52897eb to your computer and use it in GitHub Desktop.
Save bfitch/1234d85082146943e35c7d5da52897eb to your computer and use it in GitHub Desktop.
Cherry picking uniq with babel-plugin-lodash
{
"presets": [
["env", {
"targets": {
"browsers": ["chrome 58"]
},
"modules": false
}]
],
"plugins": [
"lodash",
"transform-class-properties",
"transform-object-rest-spread"
]
}
import { DocumentNode, parse, print, Kind, DefinitionNode } from 'graphql';
import { uniq } from 'lodash';
import { buildASTSchema, extendSchema } from 'graphql';
import {
GraphQLScalarType,
getNamedType,
GraphQLObjectType,
GraphQLSchema,
GraphQLResolveInfo,
GraphQLField,
GraphQLFieldResolver,
GraphQLType,
GraphQLInterfaceType,
GraphQLFieldMap,
} from 'graphql';
import {
IExecutableSchemaDefinition ,
ILogger,
IResolvers,
ITypeDefinitions,
ITypedef,
IFieldIteratorFn,
IConnectors,
IConnector,
IConnectorCls,
IResolverValidationOptions,
} from './Interfaces';
import { deprecated } from 'deprecated-decorator';
// rest omitted
"dependencies": {
"graphql-tools": "^1.0.0",
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-preset-env": "^1.5.1",
"lodash-webpack-plugin": "^0.11.4",
"uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony-v2.8.22",
"uglifyjs-webpack-plugin": "^0.4.3",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.8.2"
}
const path = require('path');
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
library: 'Library',
libraryTarget: 'umd'
},
module: {
rules: [{
loader: "babel-loader",
test: /\.js$/, exclude: /node_modules/,
options: {
plugins: ['lodash']
}
}]
},
plugins: [
new LodashModuleReplacementPlugin
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment