Skip to content

Instantly share code, notes, and snippets.

@nsfmc
Last active April 29, 2018 03:06
Show Gist options
  • Save nsfmc/1ff005d99480f58d69cfbdda48a78b55 to your computer and use it in GitHub Desktop.
Save nsfmc/1ff005d99480f58d69cfbdda48a78b55 to your computer and use it in GitHub Desktop.
@nsfmc/babel-preset-sketching, a babel 7 preset for when i just want things to work the way i expect

@nsfmc/babel-preset-sketching

in each package that would normally have some babel preset, do

echo '{"presets": ["@nsfmc/babel-preset-sketching"]}' > .babelrc

and add this package to dependencies

module.exports = function(api, opts) {
const prod = process.env.NODE_ENV === "production";
return {
presets: [
[
require("@babel/preset-env"),
{
targets: {
browsers: [">1%", "not ie 11"]
}
}
],
require("@babel/preset-flow"),
require("@babel/preset-react")
],
plugins: [
require("@babel/plugin-proposal-class-properties").default,
require("@babel/plugin-proposal-object-rest-spread").default,
require("@babel/plugin-proposal-numeric-separator").default,
require("@babel/plugin-transform-classes").default,
require("@babel/plugin-transform-destructuring").default,
prod && require("@babel/plugin-transform-react-constant-elements").default
].filter(Boolean)
};
};
{
"name": "@nsfmc/babel-preset-sketching",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@babel/cli": "^7.0.0-beta.46",
"@babel/core": "^7.0.0-beta.46",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.46",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.46",
"@babel/plugin-proposal-numeric-separator": "^7.0.0-beta.46",
"@babel/plugin-transform-classes": "^7.0.0-beta.46",
"@babel/plugin-transform-destructuring": "^7.0.0-beta.46",
"@babel/plugin-transform-react-constant-elements": "^7.0.0-beta.46",
"@babel/preset-env": "^7.0.0-beta.46",
"@babel/preset-flow": "^7.0.0-beta.46",
"@babel/preset-react": "^7.0.0-beta.46"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment