Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Fix the es distribution #10254

Merged
merged 3 commits into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 21 additions & 7 deletions .babelrc
@@ -1,5 +1,5 @@
{
"presets": ["./scripts/material-ui-babel-preset-env", "stage-1", "react"],
"presets": ["./scripts/material-ui-babel-preset", "stage-1", "react"],
"plugins": [
"transform-object-assign"
],
Expand Down Expand Up @@ -29,7 +29,7 @@
"alias": {
"pages": "./pages",
"material-ui": "./src",
"material-ui-icons": './packages/material-ui-icons/src',
"material-ui-icons": "./packages/material-ui-icons/src",
"docs": "./docs"
}
}
Expand All @@ -49,7 +49,7 @@
"alias": {
"pages": "./pages",
"material-ui": "./src",
"material-ui-icons": './packages/material-ui-icons/src',
"material-ui-icons": "./packages/material-ui-icons/src",
"docs": "./docs"
}
}
Expand All @@ -61,12 +61,20 @@
["transform-react-remove-prop-types", {"mode": "remove"}]
]
},
"test": {
"sourceMaps": "both",
"es": {
"plugins": [
"transform-flow-strip-types"
"transform-react-constant-elements",
"transform-dev-warning",
"transform-runtime",
["react-remove-properties", {"properties": ["data-mui-test"]}],
["transform-react-remove-prop-types", {
"mode": "wrap",
"plugins": [
"babel-plugin-transform-flow-strip-types"
]
}]
]
},
},
"production": {
"plugins": [
"transform-react-constant-elements",
Expand All @@ -80,6 +88,12 @@
]
}]
]
},
"test": {
"sourceMaps": "both",
"plugins": [
"transform-flow-strip-types"
]
}
}
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -25,7 +25,7 @@
"docs:dev": "rimraf node_modules/.cache/babel-loader && cross-env BABEL_ENV=docs-development next dev",
"docs:api": "rimraf pages/api/* && babel-node ./docs/scripts/buildApi.js",
"docs:icons": "rimraf static/icons/* && babel-node ./docs/scripts/buildIcons.js",
"docs:build": "cross-env BABEL_ENV=docs-production next build",
"docs:build": "cross-env NODE_ENV=production BABEL_ENV=docs-production next build",
"docs:start": "next start",
"docs:export": "next export -o docs/export",
"docs:deploy": "yarn docs:build && yarn docs:export && firebase deploy",
Expand Down
@@ -1,18 +1,16 @@
const env = require('babel-preset-env');

const ENV = process.env.BABEL_ENV;
let babelPresetEnv;
let config;

// We release a ES version of Material-UI.
// It's something that matches the latest official supported features of JavaScript.
// Nothing more (stage-1, etc), nothing less (require, etc).
if (ENV === 'es') {
babelPresetEnv = {};
config = {};
} else {
babelPresetEnv = {
config = {
presets: [
[
env,
'babel-preset-env',
{
targets: {
ie: 11,
Expand All @@ -29,4 +27,4 @@ if (ENV === 'es') {
};
}

module.exports = babelPresetEnv;
module.exports = config;