Skip to content

Commit d088ad5

Browse files
committed
Revert - Adding colors to noParse
1 parent 83024d4 commit d088ad5

File tree

4 files changed

+39
-27
lines changed

4 files changed

+39
-27
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const camelCase = require('lodash/camelCase');
4848
const bpkReactScriptsConfig = appPackageJson['backpack-react-scripts'] || {};
4949
const customModuleRegexes = bpkReactScriptsConfig.babelIncludePrefixes
5050
? bpkReactScriptsConfig.babelIncludePrefixes.map(
51-
prefix => new RegExp(`node_modules[\\/]${prefix}`)
51+
(prefix) => new RegExp(`node_modules[\\/]${prefix}`)
5252
)
5353
: [];
5454
const cssModulesEnabled = bpkReactScriptsConfig.cssModules !== false;
@@ -89,7 +89,7 @@ const scopedBackpackModulesRegex = /node_modules[\\/]@skyscanner[\\/]bpk-/;
8989

9090
// This is the production and development configuration.
9191
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
92-
module.exports = function(webpackEnv) {
92+
module.exports = function (webpackEnv) {
9393
const isEnvDevelopment = webpackEnv === 'development';
9494
const isEnvProduction = webpackEnv === 'production';
9595

@@ -225,12 +225,13 @@ module.exports = function(webpackEnv) {
225225
publicPath: paths.publicUrlOrPath,
226226
// Point sourcemap entries to original disk location (format as URL on Windows)
227227
devtoolModuleFilenameTemplate: isEnvProduction
228-
? info =>
228+
? (info) =>
229229
path
230230
.relative(paths.appSrc, info.absoluteResourcePath)
231231
.replace(/\\/g, '/')
232232
: isEnvDevelopment &&
233-
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
233+
((info) =>
234+
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
234235
// Prevents conflicts when multiple webpack runtimes (from different apps)
235236
// are used on the same page.
236237
// jsonpFunction: `webpackJsonp${appPackageJson.name}`,
@@ -331,7 +332,7 @@ module.exports = function(webpackEnv) {
331332
// },
332333
runtimeChunk: bpkReactScriptsConfig.enableAutomaticChunking
333334
? {
334-
name: entrypoint => `runtime-${entrypoint.name}`,
335+
name: (entrypoint) => `runtime-${entrypoint.name}`,
335336
}
336337
: false,
337338
},
@@ -351,8 +352,8 @@ module.exports = function(webpackEnv) {
351352
// `web` extension prefixes have been added for better support
352353
// for React Native Web.
353354
extensions: paths.moduleFileExtensions
354-
.map(ext => `.${ext}`)
355-
.filter(ext => useTypeScript || !ext.includes('ts')),
355+
.map((ext) => `.${ext}`)
356+
.filter((ext) => useTypeScript || !ext.includes('ts')),
356357
alias: {
357358
// Support React Native Web
358359
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -384,7 +385,7 @@ module.exports = function(webpackEnv) {
384385
],
385386
},
386387
module: {
387-
noParse: [/iconv-loader\.js$/, /colors\.js$/], // https://github.com/webpack/webpack/issues/3078#issuecomment-400697407
388+
noParse: /iconv-loader\.js$/, // https://github.com/webpack/webpack/issues/3078#issuecomment-400697407
388389
strictExportPresence: true,
389390
rules: [
390391
// Disable require.ensure as it's not a standard language feature.
@@ -786,7 +787,7 @@ module.exports = function(webpackEnv) {
786787
return manifest;
787788
}, seed);
788789
const entrypointFiles = entrypoints.main.filter(
789-
fileName => !fileName.endsWith('.map')
790+
(fileName) => !fileName.endsWith('.map')
790791
);
791792

792793
return {

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const sassFunctions = require('bpk-mixins/sass-functions');
4747
const bpkReactScriptsConfig = appPackageJson['backpack-react-scripts'] || {};
4848
const customModuleRegexes = bpkReactScriptsConfig.babelIncludePrefixes
4949
? bpkReactScriptsConfig.babelIncludePrefixes.map(
50-
prefix => new RegExp(`node_modules[\\/]${prefix}`)
50+
(prefix) => new RegExp(`node_modules[\\/]${prefix}`)
5151
)
5252
: [];
5353
const cssModulesEnabled = bpkReactScriptsConfig.cssModules !== false;
@@ -85,7 +85,7 @@ const scopedBackpackModulesRegex = /node_modules[\\/]@skyscanner[\\/]bpk-/;
8585

8686
// This is the production and development configuration.
8787
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
88-
module.exports = function(webpackEnv) {
88+
module.exports = function (webpackEnv) {
8989
const isEnvDevelopment = webpackEnv === 'development';
9090
const isEnvProduction = webpackEnv === 'production';
9191

@@ -117,11 +117,11 @@ module.exports = function(webpackEnv) {
117117
// : {},
118118
// },
119119
{
120-
// Since v2.0.0 css-loader/locals was removed in favour of exportOnlyLocals option
120+
// In v3.0.0 css-loader/locals was removed in favour of onlyLocals option
121121
// So adding the option here in replacement as per
122-
// https://github.com/webpack-contrib/css-loader#exportonlylocals
122+
// https://github.com/webpack-contrib/css-loader/tree/v3.4.2#onlylocals
123123
loader: require.resolve('css-loader'),
124-
options: { ...cssOptions, exportOnlyLocals: true },
124+
options: { ...cssOptions, onlyLocals: true },
125125
},
126126
{
127127
// Options for PostCSS as we reference these options twice
@@ -227,12 +227,13 @@ module.exports = function(webpackEnv) {
227227
publicPath: paths.publicUrlOrPath,
228228
// Point sourcemap entries to original disk location (format as URL on Windows)
229229
devtoolModuleFilenameTemplate: isEnvProduction
230-
? info =>
230+
? (info) =>
231231
path
232232
.relative(paths.appSrc, info.absoluteResourcePath)
233233
.replace(/\\/g, '/')
234234
: isEnvDevelopment &&
235-
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
235+
((info) =>
236+
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
236237
},
237238
optimization: {
238239
// minimize: isEnvProduction,
@@ -330,8 +331,8 @@ module.exports = function(webpackEnv) {
330331
// `web` extension prefixes have been added for better support
331332
// for React Native Web.
332333
extensions: paths.moduleFileExtensions
333-
.map(ext => `.${ext}`)
334-
.filter(ext => useTypeScript || !ext.includes('ts')),
334+
.map((ext) => `.${ext}`)
335+
.filter((ext) => useTypeScript || !ext.includes('ts')),
335336
alias: {
336337
// Support React Native Web
337338
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -363,7 +364,7 @@ module.exports = function(webpackEnv) {
363364
],
364365
},
365366
module: {
366-
noParse: [/iconv-loader\.js$/, /colors\.js$/], // https://github.com/webpack/webpack/issues/3078#issuecomment-400697407
367+
noParse: /iconv-loader\.js$/, // https://github.com/webpack/webpack/issues/3078#issuecomment-400697407
367368
strictExportPresence: true,
368369
rules: [
369370
// Disable require.ensure as it's not a standard language feature.

packages/react-scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@skyscanner/backpack-react-scripts",
3-
"version": "8.1.0-alpha",
3+
"version": "8.1.0-beta.0",
44
"description": "Backpack configuration and scripts for Create React App.",
55
"repository": {
66
"type": "git",

packages/react-scripts/scripts/start-ssr.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ process.env.NODE_ENV = 'development';
1515
// Makes the script crash on unhandled rejections instead of silently
1616
// ignoring them. In the future, promise rejections that are not handled will
1717
// terminate the Node.js process with a non-zero exit code.
18-
process.on('unhandledRejection', err => {
18+
process.on('unhandledRejection', (err) => {
1919
throw err;
2020
});
2121

@@ -32,26 +32,36 @@ verifyTypeScriptSetup();
3232
// @remove-on-eject-end
3333

3434
const fs = require('fs');
35-
const { createCompiler } = require('react-dev-utils/WebpackDevServerUtils');
3635
const webpack = require('webpack');
37-
38-
const configFactory = require('../config/webpack.config.ssr');
36+
const {
37+
createCompiler,
38+
prepareUrls,
39+
} = require('react-dev-utils/WebpackDevServerUtils');
3940
const paths = require('../config/paths');
41+
const configFactory = require('../config/webpack.config.ssr');
4042

4143
const statusFile = require('./utils/statusFile');
4244

4345
const config = configFactory('development');
4446
const appName = require(paths.appPackageJson).name;
4547
const useYarn = fs.existsSync(paths.yarnLockFile);
46-
4748
const useTypeScript = fs.existsSync(paths.appTsConfig);
4849
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
50+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
51+
const HOST = process.env.HOST || '0.0.0.0';
52+
const port = parseInt(process.env.PORT, 10) || 3000;
53+
const urls = prepareUrls(
54+
protocol,
55+
HOST,
56+
port,
57+
paths.publicUrlOrPath.slice(0, -1)
58+
);
4959

5060
const createCompilerOpts = {
5161
appName,
5262
config,
5363
devSocket: undefined,
54-
urls: undefined,
64+
urls,
5565
useYarn,
5666
useTypeScript,
5767
tscCompileOnError,
@@ -65,7 +75,7 @@ compiler.watch(
6575
{
6676
ignored: ['node_modules'],
6777
},
68-
err => {
78+
(err) => {
6979
if (err) {
7080
console.log(err.message || err);
7181
process.exit(1);

0 commit comments

Comments
 (0)