Conversation
lemonmade
commented
Sep 14, 2016
|
|
||
| module.exports = function shopifyNodePreset(context, options) { | ||
| options = options || {}; | ||
| var version = options.version || '5.7.0'; |
Member
Author
There was a problem hiding this comment.
Note to self: probably just default to process.version.
lemonmade
commented
Sep 14, 2016
| require('babel-preset-stage-2'), | ||
| ], | ||
| plugins: [ | ||
| require('babel-plugin-transform-class-properties'), |
Member
Author
|
Reping @Shopify/javascript — how do people feel about arranging the Babel presets in this way? Will this make our Babel preset usable by all projects you folks are currently working on? What can we do to make that happen, if the answer is no? |
Contributor
|
This makes sense. I'm OK with it as long as it's backwards-compatible |
|
LGTM from a marketing/growth perspective. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates how Shopify's Babel presets work. I know I kind of did this before and we decided not to separate them out so much, but I have some use cases where this makes sense and I feel like it is more in line with our linting configs.
Basically, it works like this:
es2015preset. This allows us to use the{modules: false}option for our config, which makes the preset work with Rollup and Webpack 2 tree shaking.modules(just like the web one), andversionfor specifying a desired version of Node. I was using a preset that just usedprocess.versionto check what plugins to add, but that didn't make sense since you usually develop in a more modern version of node than the one you build for. I just copied the logic into our own config so that you can manually specify the version.I like this structure much better personally. It also enables things I've been working on: using Webpack 2 to do tree-shaked builds of both server and client bundles, both of which need the React transforms as well. The config just requires two lines instead of one for the client bundle, and the preset can actually be used for node without over-transforming stuff that doesn't need to be transformed:
cc/ @Shopify/javascript @bouk thoughts?