Skip to content

Commit b9ba85d

Browse files
authored
Merge pull request #13 from digitalorigin/feature/update_to_upstream
Add support for CSS-Modules + Merge from upstream up to v1.1.4
2 parents 7d04585 + 0e3b1fb commit b9ba85d

File tree

8 files changed

+267
-45
lines changed

8 files changed

+267
-45
lines changed

CHANGELOG.md

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,85 @@
1+
## 1.1.4 (April 3, 2018)
2+
3+
#### :bug: Bug Fix
4+
5+
* `react-dev-utils`
6+
7+
* [#4250](https://github.com/facebook/create-react-app/pull/4250) Upgrade `detect-port-alt` to fix [#4189](https://github.com/facebook/create-react-app/issues/4189). ([@Timer](https://github.com/Timer))
8+
9+
#### Committers: 1
10+
- Joe Haddad ([Timer](https://github.com/Timer))
11+
12+
### Migrating from 1.1.3 to 1.1.4
13+
14+
Inside any created project that has not been ejected, run:
15+
16+
```
17+
npm install --save --save-exact react-scripts@1.1.4
18+
```
19+
20+
or
21+
22+
```
23+
yarn add --exact react-scripts@1.1.4
24+
```
25+
26+
## 1.1.3 (April 3, 2018)
27+
28+
#### :bug: Bug Fix
29+
30+
* `react-scripts`
31+
32+
* [#4247](https://github.com/facebook/create-react-app/pull/4247) Fix `environment.dispose is not a function` error caused by a Jest bug. ([@gaearon](https://github.com/gaearon))
33+
34+
#### Committers: 1
35+
- Dan Abramov ([gaearon](https://github.com/gaearon))
36+
37+
### Migrating from 1.1.2 to 1.1.3
38+
39+
Inside any created project that has not been ejected, run:
40+
41+
```
42+
npm install --save --save-exact react-scripts@1.1.3
43+
```
44+
45+
or
46+
47+
```
48+
yarn add --exact react-scripts@1.1.3
49+
```
50+
51+
## 1.1.2 (April 3, 2018)
52+
53+
#### :bug: Bug Fix
54+
55+
* `react-scripts`
56+
57+
* [#4085](https://github.com/facebook/create-react-app/pull/4085) Resolve `.js` before `.mjs` files to unbreak dependencies with native ESM support. ([@leebyron](https://github.com/leebyron))
58+
59+
#### :memo: Documentation
60+
61+
* `react-scripts`
62+
63+
* [#4197](https://github.com/facebook/create-react-app/pull/4197) Add troubleshooting for Github Pages. ([@xnt](https://github.com/xnt))
64+
65+
#### Committers: 2
66+
- Lee Byron ([leebyron](https://github.com/leebyron))
67+
- Vicente Plata ([xnt](https://github.com/xnt))
68+
69+
### Migrating from 1.1.1 to 1.1.2
70+
71+
Inside any created project that has not been ejected, run:
72+
73+
```
74+
npm install --save --save-exact react-scripts@1.1.2
75+
```
76+
77+
or
78+
79+
```
80+
yarn add --exact react-scripts@1.1.2
81+
```
82+
183
## 1.1.1 (February 2, 2018)
284

385
#### :bug: Bug Fix
@@ -49,7 +131,7 @@ yarn add --exact react-scripts@1.1.1
49131
* `react-error-overlay`
50132

51133
* [#3474](https://github.com/facebookincubator/create-react-app/pull/3474) Allow the error overlay to be unregistered. ([@Timer](https://github.com/Timer))
52-
134+
53135
* `create-react-app`
54136

55137
* [#3408](https://github.com/facebookincubator/create-react-app/pull/3408) Add `--info` flag to help gather bug reports. ([@tabrindle](https://github.com/tabrindle))
@@ -75,7 +157,7 @@ yarn add --exact react-scripts@1.1.1
75157
* `create-react-app`
76158

77159
* [#3320](https://github.com/facebookincubator/create-react-app/pull/3320) Fix offline installation to respect proxy from `.npmrc`. ([@mdogadailo](https://github.com/mdogadailo))
78-
160+
79161
* `react-scripts`
80162

81163
* [#3537](https://github.com/facebookincubator/create-react-app/pull/3537) Add `mjs` and `jsx` filename extensions to `file-loader` exclude pattern. ([@iansu](https://github.com/iansu))

packages/react-dev-utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-dev-utils",
3-
"version": "5.0.0",
3+
"version": "5.0.1",
44
"description": "Webpack utilities used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "MIT",
@@ -40,7 +40,7 @@
4040
"babel-code-frame": "6.26.0",
4141
"chalk": "1.1.3",
4242
"cross-spawn": "5.1.0",
43-
"detect-port-alt": "1.1.5",
43+
"detect-port-alt": "1.1.6",
4444
"escape-string-regexp": "1.0.5",
4545
"filesize": "3.5.11",
4646
"global-modules": "1.0.0",

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ if (process.env.SASS_RESOURCES_TO_INJECT) {
3535
extraSassLoaders.push({
3636
loader: require.resolve('sass-resources-loader'),
3737
options: {
38-
resources: process.env.SASS_RESOURCES_TO_INJECT
39-
.split(' ')
40-
.map(sassPath => path.resolve(paths.appPath, sassPath)),
38+
resources: process.env.SASS_RESOURCES_TO_INJECT.split(' ').map(sassPath =>
39+
path.resolve(paths.appPath, sassPath)
40+
),
4141
},
4242
});
4343
}
@@ -109,9 +109,7 @@ module.exports = {
109109
// It usually still works on npm 3 without this but it would be
110110
// unfortunate to rely on, as react-scripts could be symlinked,
111111
// and thus babel-runtime might not be resolvable from the source.
112-
'babel-runtime': path.dirname(
113-
require.resolve('babel-runtime/package.json')
114-
),
112+
'babel-runtime': path.dirname(require.resolve('babel-runtime/package.json')),
115113
// @remove-on-eject-end
116114
// Support React Native Web
117115
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -152,11 +150,7 @@ module.exports = {
152150
eslintPath: require.resolve('eslint'),
153151
// @remove-on-eject-begin
154152
baseConfig: {
155-
extends: [
156-
require.resolve(
157-
'@digital-origin/eslint-config-digital-origin'
158-
),
159-
],
153+
extends: [require.resolve('@digital-origin/eslint-config-digital-origin')],
160154
},
161155
ignore: false,
162156
useEslintrc: false,
@@ -191,9 +185,7 @@ module.exports = {
191185
options: {
192186
// @remove-on-eject-begin
193187
babelrc: false,
194-
presets: [
195-
require.resolve('@digital-origin/babel-preset-react-app'),
196-
],
188+
presets: [require.resolve('@digital-origin/babel-preset-react-app')],
197189
// @remove-on-eject-end
198190
// This is a feature of `babel-loader` for webpack (not Babel itself).
199191
// It enables caching results in ./node_modules/.cache/babel-loader/
@@ -238,6 +230,50 @@ module.exports = {
238230
},
239231
],
240232
},
233+
{
234+
test: /\.module\.scss$/,
235+
use: [
236+
require.resolve('style-loader'),
237+
{
238+
loader: require.resolve('css-loader'),
239+
options: {
240+
importLoaders: 1,
241+
modules: true,
242+
localIdentName: '[name]_[local]__[hash:base64:5]',
243+
},
244+
},
245+
{
246+
loader: require.resolve('postcss-loader'),
247+
options: {
248+
// Necessary for external CSS imports to work
249+
// https://github.com/facebookincubator/create-react-app/issues/2677
250+
ident: 'postcss',
251+
sourceMap: true,
252+
plugins: () => [
253+
require('postcss-flexbugs-fixes'),
254+
autoprefixer({
255+
browsers: [
256+
'>1%',
257+
'last 4 versions',
258+
'Firefox ESR',
259+
'not ie < 9', // React doesn't support IE8 anyway
260+
],
261+
flexbox: 'no-2009',
262+
}),
263+
],
264+
},
265+
},
266+
{
267+
loader: require.resolve('sass-loader'),
268+
options: {
269+
outputStyle: 'expanded',
270+
sourceMap: true,
271+
includePaths: [].concat(paths.appSrc),
272+
},
273+
},
274+
...extraSassLoaders,
275+
],
276+
},
241277
{
242278
test: /\.scss$/,
243279
use: [

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
2121
const paths = require('./paths');
2222
const getClientEnvironment = require('./env');
2323
const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
24-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
25-
.BundleAnalyzerPlugin;
24+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
2625
// Webpack uses `publicPath` to determine where the app is being served from.
2726
// It requires a trailing slash, or the file assets will get an incorrect path.
2827
const publicPath = paths.servedPath;
@@ -67,10 +66,7 @@ const doPlugins = [
6766
];
6867

6968
// Add rollbar only if react app env is production and we have rollbar token
70-
if (
71-
process.env.ROLLBAR_SERVER_TOKEN &&
72-
env.raw.REACT_APP_ENV === 'production'
73-
) {
69+
if (process.env.ROLLBAR_SERVER_TOKEN && env.raw.REACT_APP_ENV === 'production') {
7470
doPlugins.push(
7571
new RollbarSourceMapPlugin({
7672
accessToken: process.env.ROLLBAR_SERVER_TOKEN,
@@ -89,9 +85,9 @@ if (process.env.SASS_RESOURCES_TO_INJECT) {
8985
extraSassLoaders.push({
9086
loader: require.resolve('sass-resources-loader'),
9187
options: {
92-
resources: process.env.SASS_RESOURCES_TO_INJECT
93-
.split(' ')
94-
.map(sassPath => path.resolve(paths.appPath, sassPath)),
88+
resources: process.env.SASS_RESOURCES_TO_INJECT.split(' ').map(sassPath =>
89+
path.resolve(paths.appPath, sassPath)
90+
),
9591
},
9692
});
9793
}
@@ -124,9 +120,7 @@ module.exports = {
124120
publicPath: publicPath,
125121
// Point sourcemap entries to original disk location (format as URL on Windows)
126122
devtoolModuleFilenameTemplate: info =>
127-
path
128-
.relative(paths.appSrc, info.absoluteResourcePath)
129-
.replace(/\\/g, '/'),
123+
path.relative(paths.appSrc, info.absoluteResourcePath).replace(/\\/g, '/'),
130124
},
131125
resolve: {
132126
// This allows you to set a fallback for where Webpack should look for modules.
@@ -150,9 +144,7 @@ module.exports = {
150144
// It usually still works on npm 3 without this but it would be
151145
// unfortunate to rely on, as react-scripts could be symlinked,
152146
// and thus babel-runtime might not be resolvable from the source.
153-
'babel-runtime': path.dirname(
154-
require.resolve('babel-runtime/package.json')
155-
),
147+
'babel-runtime': path.dirname(require.resolve('babel-runtime/package.json')),
156148
// @remove-on-eject-end
157149
// Support React Native Web
158150
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -194,11 +186,7 @@ module.exports = {
194186
// TODO: consider separate config for production,
195187
// e.g. to enable no-console and no-debugger only in production.
196188
baseConfig: {
197-
extends: [
198-
require.resolve(
199-
'@digital-origin/eslint-config-digital-origin'
200-
),
201-
],
189+
extends: [require.resolve('@digital-origin/eslint-config-digital-origin')],
202190
},
203191
ignore: false,
204192
useEslintrc: false,
@@ -232,9 +220,7 @@ module.exports = {
232220
options: {
233221
// @remove-on-eject-begin
234222
babelrc: false,
235-
presets: [
236-
require.resolve('@digital-origin/babel-preset-react-app'),
237-
],
223+
presets: [require.resolve('@digital-origin/babel-preset-react-app')],
238224
// @remove-on-eject-end
239225
compact: true,
240226
},
@@ -299,6 +285,59 @@ module.exports = {
299285

300286
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
301287
},
288+
{
289+
test: /\.modules\.scss$/,
290+
loader: ExtractTextPlugin.extract(
291+
Object.assign(
292+
{
293+
fallback: require.resolve('style-loader'),
294+
use: [
295+
{
296+
loader: require.resolve('css-loader'),
297+
options: {
298+
importLoaders: 1,
299+
modules: true,
300+
minimize: true,
301+
sourceMap: true,
302+
},
303+
},
304+
{
305+
loader: require.resolve('postcss-loader'),
306+
options: {
307+
// Necessary for external CSS imports to work
308+
// https://github.com/facebookincubator/create-react-app/issues/2677
309+
ident: 'postcss',
310+
sourceMap: true,
311+
plugins: () => [
312+
require('postcss-flexbugs-fixes'),
313+
autoprefixer({
314+
browsers: [
315+
'>1%',
316+
'last 4 versions',
317+
'Firefox ESR',
318+
'not ie < 9', // React doesn't support IE8 anyway
319+
],
320+
flexbox: 'no-2009',
321+
}),
322+
],
323+
},
324+
},
325+
{
326+
loader: require.resolve('sass-loader'),
327+
options: {
328+
outputStyle: 'expanded',
329+
sourceMap: true,
330+
includePaths: [].concat(paths.appSrc),
331+
},
332+
},
333+
...extraSassLoaders,
334+
],
335+
},
336+
extractTextPluginOptions
337+
)
338+
),
339+
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
340+
},
302341
{
303342
test: /\.scss$/,
304343
loader: ExtractTextPlugin.extract(

packages/react-scripts/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@digital-origin/react-scripts",
3-
"version": "3.5.0",
3+
"version": "3.6.0-2",
44
"description": "Configuration and scripts for Create React App.",
55
"repository": "facebookincubator/create-react-app",
66
"license": "MIT",
@@ -56,7 +56,8 @@
5656
"prettier": "1.8.2",
5757
"promise": "8.0.1",
5858
"raf": "3.4.0",
59-
"react-dev-utils": "^5.0.0",
59+
"react-dev-utils": "^5.0.1",
60+
"resolve": "1.6.0",
6061
"rollbar-sourcemap-webpack-plugin": "^2.2.0",
6162
"sass-loader": "^6.0.6",
6263
"sass-resources-loader": "^1.3.2",

0 commit comments

Comments
 (0)