diff --git a/.babelrc b/.babelrc index 985adfb..e8c7174 100644 --- a/.babelrc +++ b/.babelrc @@ -1,6 +1,9 @@ { "presets": ["react", "es2015", "stage-0"], - "plugins": ["transform-runtime", ["react-intl", {"messagesDir": "./dist/messages/"}]], + "plugins": [ + ["transform-runtime", {"polyfill": false}], + ["react-intl", {"messagesDir": "./dist/messages/"}] + ], "env": { "development": { "presets": ["react-hmre"] diff --git a/src/polyfills.js b/src/polyfills.js index a0d34fc..02e6eb6 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -1,4 +1,5 @@ import 'babel-polyfill'; +import 'whatwg-fetch'; import 'promise.prototype.finally'; // allow :active styles in mobile Safary diff --git a/webpack.config.js b/webpack.config.js index ba09521..fbba336 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,6 +13,7 @@ const cssImport = require('postcss-import'); const vendor = Object.keys(require('./package.json').dependencies); const rootPath = path.resolve('./src'); +const outputPath = path.join(__dirname, 'dist'); var config = {}; try { @@ -73,14 +74,16 @@ const cssLoaderQuery = { } }; -var webpackConfig = { +const webpackConfig = { + cache: true, + entry: { app: path.join(__dirname, 'src'), vendor: vendor }, output: { - path: path.join(__dirname, 'dist'), + path: outputPath, publicPath: '/', filename: '[name].js?[hash]' }, @@ -120,10 +123,6 @@ var webpackConfig = { collapseWhitespace: isProduction }, ga: config.ga - }), - new webpack.ProvidePlugin({ - // window.fetch polyfill - fetch: 'imports?this=>self!exports?self.fetch!whatwg-fetch' }) ].concat(isTest ? [] : [ new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js?[hash]') @@ -142,7 +141,7 @@ var webpackConfig = { { test: /\.jsx?$/, exclude: /node_modules/, - loader: 'babel' + loader: 'babel?cacheDirectory=true' }, { test: /\.(png|gif|jpg|svg)$/,