diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 253bc34f062..4d5f6b0893a 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -13,10 +13,12 @@ const autoprefixer = require('autoprefixer'); const path = require('path'); const webpack = require('webpack'); +const defaults = require('lodash.defaults'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); +const AutoDllPlugin = require('autodll-webpack-plugin'); const eslintFormatter = require('react-dev-utils/eslintFormatter'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const getClientEnvironment = require('./env'); @@ -31,6 +33,8 @@ const publicPath = '/'; const publicUrl = ''; // Get environment variables to inject into our app. const env = getClientEnvironment(publicUrl); +// Read the dll configuration from package.json +const dllConfig = require(paths.appPackageJson).dll || { entry: {} }; // This is the development configuration. // It is focused on developer experience and fast rebuilds. @@ -252,6 +256,15 @@ module.exports = { inject: true, template: paths.appHtml, }), + new AutoDllPlugin({ + context: paths.appPath, + path: './dll', + filename: '[name].js', + inject: true, + entry: defaults(dllConfig.entry, { + polyfills: [require.resolve('./polyfills')], + }), + }), // Add module names to factory functions so they appear in browser profiler. new webpack.NamedModulesPlugin(), // Makes some environment variables available to the JS code, for example: diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index d0eddad69e5..2e0752854a7 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -42,6 +42,8 @@ "extract-text-webpack-plugin": "2.1.2", "file-loader": "0.11.2", "fs-extra": "3.0.1", + "html-webpack-plugin": "2.28.0", + "jest": "20.0.3", "html-webpack-plugin": "2.29.0", "jest": "20.0.4", "object-assign": "4.1.1", @@ -56,7 +58,9 @@ "webpack": "2.6.1", "webpack-dev-server": "2.5.0", "webpack-manifest-plugin": "1.1.0", - "whatwg-fetch": "2.0.3" + "whatwg-fetch": "2.0.3", + "lodash.defaults": "^4.2.0", + "autodll-webpack-plugin": "^0.2.1" }, "devDependencies": { "react": "^15.5.4",