Skip to content

Instantly share code, notes, and snippets.

@johnstew
johnstew / utils.js
Created February 2, 2017 00:32
tree-shaking webpack utils.js
export function foo() {
console.log('foo called');
}
export function bar() {
console.log('bar called');
}
@johnstew
johnstew / index.js
Created February 2, 2017 00:32
tree-shaking webpack index.js
import { foo } from './utils';
foo();
@johnstew
johnstew / .babelrc
Created February 1, 2017 17:17
babelrc with preset-env and lodash
{
"presets": [
[
"env", {
"targets": {
"browsers": [
"last 2 versions",
"safari >= 7"
]
},
@johnstew
johnstew / webpack.config.js
Created January 31, 2017 03:09
tree-shaking webpack.config.js
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'src/index.js'),
output: {
filename: 'index.bundle.js',
path: path.resolve(__dirname, 'build')
},
module: {
@johnstew
johnstew / webpack.config.js
Created January 28, 2017 18:47
basic webpack config
const path = require('path');
module.exports = {
entry: path.join(__dirname, 'index.js'),
output: {
filename: 'index.bundle.js',
path: path.join(__dirname, 'build')
}
};
@johnstew
johnstew / blog-webpack-2.md
Created January 18, 2017 13:14 — forked from xjamundx/blog-webpack-2.md
From Require.js to Webpack - Part 2 (the how)

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

@johnstew
johnstew / gist:424cf77d3eb8e3907e541c0d3230f39f
Created November 2, 2016 16:26 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@johnstew
johnstew / .eslintrc
Created September 2, 2016 17:40
.eslintrc
{
"extends": ["airbnb"],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["react"],
@johnstew
johnstew / getset.js
Created August 22, 2016 20:51
JS getset
getset: function(model, prop, value) {
var last = model.get(prop);
if (value !== undefined) {
model.set(prop, value);
}
return last;
}
@johnstew
johnstew / webpack.config.js
Created February 26, 2016 21:57
Webpack Config
var webpack = require('webpack');
module.exports = {
devtool: 'source-map',
entry: {
main: [
'./src/app.js',
'webpack-dev-server/client?http://localhost:8080'
]
},