Skip to content

Instantly share code, notes, and snippets.

@mannycolon
Created January 18, 2018 04:15
Show Gist options
  • Save mannycolon/317aa2dd70a8a18e800ae35398628ffd to your computer and use it in GitHub Desktop.
Save mannycolon/317aa2dd70a8a18e800ae35398628ffd to your computer and use it in GitHub Desktop.
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const webpack = require('webpack')
module.exports = {
entry: ['react-hot-loader/patch', './playground/index.js'],
devServer: {
contentBase: './dist',
hot: true,
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
presets: [['env', { modules: false }], 'react'],
plugins: [
'transform-class-properties',
'transform-object-rest-spread',
'react-hot-loader/babel',
],
},
},
},
],
},
output: {
path: path.resolve(__dirname, './dist'),
filename: 'bundle.js',
},
plugins: [
new HtmlWebpackPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
],
}
@mannycolon
Copy link
Author

mannycolon commented Jan 18, 2018

.babelrc

{
  "presets": ["env", "react"],

  "plugins": [
    "transform-class-properties",
    "transform-object-rest-spread"
  ]
}

package.json

"scripts": {
    "build": "babel src --out-dir lib",
    "precommit": "lint-staged",
    "prepublish": "yarn build",
    "start": "webpack-dev-server --open",
    "test": "jest"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-eslint": "^8.2.1",
    "babel-jest": "^22.0.6",
    "babel-loader": "^7.1.2",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "eslint": "^4.15.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-prettier": "^2.4.0",
    "eslint-plugin-react": "^7.5.1",
    "html-webpack-plugin": "^2.30.1",
    "husky": "^0.14.3",
    "jest": "^22.0.6",
    "lint-staged": "^6.0.0",
    "prettier": "^1.10.2",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-hot-loader": "^4.0.0-beta.14",
    "webpack": "^3.10.0",
    "webpack-dev-server": "^2.11.0"
  },
  "dependencies": {
    "minimatch": "^3.0.4",
    "prop-types": "^15.6.0",
    "react-test-renderer": "^16.2.0",
    "xstate": "^3.0.1"
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment