From 594c0f54a911f4f1e314bba7dcfa56912bff7ba4 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Fri, 25 Aug 2017 23:35:33 +0200 Subject: [PATCH] Fix babel transpiling. --- .babelrc | 31 ++++++++++++++----------------- src/.babelrc | 32 ++++++++++++++++++++++++++++++++ src/Footer.jsx | 1 - webpack.config.babel.js | 7 ++++++- 4 files changed, 52 insertions(+), 19 deletions(-) create mode 100644 src/.babelrc diff --git a/.babelrc b/.babelrc index 17e0199..d4ac13b 100644 --- a/.babelrc +++ b/.babelrc @@ -1,25 +1,22 @@ { "presets": [ ["babel-preset-env", { - "loose": false, - "modules": false - }], - "babel-preset-react" + "targets": { + "browsers": [ + "> 1%", + "last 4 versions", + "Firefox ESR", + "ios >= 8" + ], + "uglify": false + }, + "spec": true, + "debug": true + }] ], "plugins": [ - "react-hot-loader/babel", - "babel-plugin-transform-react-constant-elements", [ - "babel-plugin-transform-react-remove-prop-types", {} - ], - "babel-plugin-transform-decorators-legacy", - "babel-plugin-transform-class-properties", [ - "babel-plugin-transform-runtime", { - "helpers": false, - "polyfill": false, - "regenerator": true, - "moduleName": "nwb" - } - ], + "babel-plugin-transform-react-constant-elements", + "babel-plugin-transform-class-properties", "babel-plugin-syntax-dynamic-import" ] } \ No newline at end of file diff --git a/src/.babelrc b/src/.babelrc new file mode 100644 index 0000000..3bdd031 --- /dev/null +++ b/src/.babelrc @@ -0,0 +1,32 @@ +{ + "presets": [ + ["babel-preset-env", { + "targets": { + "browsers": [ + "> 1%", + "last 4 versions", + "Firefox ESR", + "ios >= 8" + ], + "uglify": false + }, + /*"spec": true,*/ + "debug": true, + "modules": false + }], + "babel-preset-react" + ], + "plugins": [ + "react-hot-loader/babel", + "babel-plugin-transform-react-constant-elements", + /*"babel-plugin-transform-react-remove-prop-types",*/ + /*"babel-plugin-transform-decorators-legacy",*/ + "babel-plugin-transform-class-properties", + ["babel-plugin-transform-runtime", { + "helpers": false, + "polyfill": false, + "regenerator": true + }], + "babel-plugin-syntax-dynamic-import" + ] +} \ No newline at end of file diff --git a/src/Footer.jsx b/src/Footer.jsx index 420cb9f..8138b95 100644 --- a/src/Footer.jsx +++ b/src/Footer.jsx @@ -16,7 +16,6 @@ Footer.propTypes = { className: PropTypes.string, }; - Footer.defaultProps = { children: null, className: null, diff --git a/webpack.config.babel.js b/webpack.config.babel.js index 82179ec..ea21bfa 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -142,6 +142,9 @@ export default (options) => { importLoaders: 1, sourceMap: true, modules: true, + localIdentName: production + ? '[name]__[local]--[hash:base64:5]' + : '[name]__[local]--[hash:base64:5]', }, }, { @@ -210,10 +213,12 @@ export default (options) => { loader: 'babel-loader', exclude: /node_modules/, options: { - // Look for babel configuration in project directory + // Look for babel configuration in project directory babelrc: true, // Cache transformations to the filesystem (in default temp dir) cacheDirectory: true, + // Skip module transpiling as Webpack 2+ support it ootb + forceEnv: 'browser', }, }, ...[