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

Add DLL support to CRA #2710

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already has html-webpack-plugin 2.29.0. Can remove this

"jest": "20.0.3",
Copy link
Contributor

@andykenward andykenward Jan 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"jest": "20.0.4" is already in packages.json. Should remove this line "jest": "20.0.3"

"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"object-assign": "4.1.1",
Expand All @@ -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",
Expand Down