Releases: firstlookmedia/react-scripts
v2.0.0-rc4
- adds
.js
/.jsx
testing and coverage support back in - fixes enzyme/react-test-renderer compatibility issue with the new Context API (requires React 16.3+)
v2.0.0-rc3
Server-side HMR in development
Before, the server
entry simply started a node server. The start
script would stop it & and start again. This change adds webpack HMR to the server config, which means the node server needs to know how to reload itself
Before
// server.js
- const app = express();
- // app code ...
- app.listen(PORT);
After
// server/app.js
+const app = express();
+// app code ...
+export default app;
// server.js
+import http from 'http';
+import app from './server/app';
+const server = http.createServer(app);
+server.listen(APP_PORT);
+if (module.hot) {
+ let currentApp = app;
+ module.hot.accept('./server/app', () => {
+ server.removeListener('request', currentApp);
+ const app = require('./server/app').default;
+ server.on('request', app);
+ currentApp = app;
+ })
+}
v2.0.0-rc2, rc1 + persisted queries support
Persisted queries support
Refer to updated readme.md
for directions on how to enable persisted queries. They are disabled by default and the option won't affect sites at all if upgraded to this release without enabling.
v2.0.0-rc1: React 16, Webpack 4
Node 8
Please update node
to ^8.0.0
React 16
Please update react
to ^16.0.0
and any other packages that depend on this.
Testing
This release updates enzyme
to v3.
Read the enzyme migration guide here
react-scripts now makes mount
and shallow
globally available to tests, so these imports can be removed.
-import { mount, shallow } from 'enzyme';
You need to remove enzyme
from package.json:
- "enzyme": "^ 2.9.0",
Manifest
The manifest plugin now properly prepends /assets/
so these lines needs updating:
- <link href="/assets/${manifest['main.css']}" type="text/css" rel="stylesheet">
+ <link href="${manifest['main.css']}" type="text/css" rel="stylesheet">
PreCSS
This updates PreCSS to v2 (to be compatible with updated PostCSS). There are no documented breaking changes, but we've seen some changed behavior using @mixin
combined with var
. Automatically computed values (via postcss-calc
) are now more strict (e.g. it will no longer let you divide by units like em
and %
):
- width: calc(2 / 300%);
+ width: calc(200% / 3);
Sass support
This release adds support for SCSS via .scss
file extensions. A few things to note:
.css
files will still be processed by PreCSS, which will remove things like:root { --variable: value }
. If you wish to preserve these, use.scss
files (even if they don't use sass features)
Relay mocks
The Relay.RootContainer
mock for testing will now render props.renderFetched({})
(previously rendered null
). This will make some components break which expect data, but allows you to send mock data to these components.
v1.0.2
v1.0.1
v1.0.0
Relay Modern
This is a major change that enables Relay Modern. To upgrade:
yarn add --dev babel-plugin-relay relay-compiler
Update .babelrc
config to include:
{
"plugins": [
["relay", {"compat": true, "schema": "schema.graphql"}]
]
}
You'll need to make sure the schema.graphql
is constructed using a newer version of the graphql
package (>= 0.8
)
Consumers can now remove existing babel-relay-plugin
-related files.
This also adds support for react-scripts
configuration via consumer's package.json
. The only option currently is sharedComponentModule
, e.g.:
"react-scripts": {
"sharedComponentModule": "eyrie"
}
This option is required to share Relay Modern components via node_modules. It's expected that the module has a lib
folder containing the components.
0.17.0
- removes
react-scripts/lib/basicAuthMiddleware
in favor of https://github.com/firstlookmedia/basic-auth-middleware - removes
react-scripts/lib/ipBypassMiddleware
in favor of https://github.com/firstlookmedia/basic-auth-middleware#ip-bypass
This is a breaking change
To update, install the basic-auth-middleware
above:
yarn add git+ssh://[email protected]/firstlookmedia/basic-auth-middleware.git
-import ipBypassMiddleware from 'react-scripts/lib/ipBypassMiddleware'
-import basicAuthMiddleware from 'react-scripts/lib/basicAuthMiddleware';
-app.use(ipBypassMiddleware);
-app.use(basicAuthMiddleware);
+import basicAuthMiddleware from 'basic-auth-middleware';
+const BASIC_AUTH_USER = process.env.BASIC_AUTH_USER;
+const BASIC_AUTH_PASS = process.env.BASIC_AUTH_PASS;
+const IP_BYPASS = process.env.IP_BYPASS;
+app.use(basicAuthMiddleware({
+ username: BASIC_AUTH_USER,
+ passwordHash: BASIC_AUTH_PASS,
+ allowedIPs: typeof IP_BYPASS === 'string' ? IP_BYPASS.split(',') : null,
+}));