with `isYesDefault`.
-function prompt(question, isYesDefault) {
- if (typeof isYesDefault !== 'boolean') {
- throw new Error('Provide explicit boolean isYesDefault as second argument.');
- }
- return new Promise(resolve => {
- var rlInterface = rl.createInterface({
- input: process.stdin,
- output: process.stdout,
- });
-
- var hint = isYesDefault === true ? '[Y/n]' : '[y/N]';
- var message = question + ' ' + hint + '\n';
-
- rlInterface.question(message, function(answer) {
- rlInterface.close();
-
- var useDefault = answer.trim().length === 0;
- if (useDefault) {
- return resolve(isYesDefault);
- }
-
- var isYes = answer.match(/^(yes|y)$/i);
- return resolve(isYes);
- });
- });
-}
-
-module.exports = prompt;
diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js
index 78002b28e..f2f206a5c 100644
--- a/packages/react-dev-utils/webpackHotDevClient.js
+++ b/packages/react-dev-utils/webpackHotDevClient.js
@@ -22,9 +22,7 @@ var SockJS = require('sockjs-client');
var stripAnsi = require('strip-ansi');
var url = require('url');
var formatWebpackMessages = require('./formatWebpackMessages');
-var Entities = require('html-entities').AllHtmlEntities;
var ansiHTML = require('./ansiHTML');
-var entities = new Entities();
function createOverlayIframe(onIframeLoad) {
var iframe = document.createElement('iframe');
@@ -138,7 +136,7 @@ function showErrorOverlay(message) {
'margin-bottom: 0.5em; overflow-x: auto; white-space: pre-wrap; ' +
'border-radius: 0.25rem; background-color: rgba(206, 17, 38, 0.05)">' +
'' +
- ansiHTML(entities.encode(message)) +
+ ansiHTML(message) +
'
' +
'
+ x === 'build' || x === 'eject' || x === 'start' || x === 'test');
+const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
+const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
switch (script) {
case 'build':
@@ -21,7 +25,9 @@ switch (script) {
case 'test': {
const result = spawn.sync(
'node',
- [require.resolve('../scripts/' + script)].concat(args),
+ nodeArgs
+ .concat(require.resolve('../scripts/' + script))
+ .concat(args.slice(scriptIndex + 1)),
{ stdio: 'inherit' }
);
if (result.signal) {
diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js
index 2934aeae6..a00468b9f 100644
--- a/packages/react-scripts/config/webpack.config.dev.js
+++ b/packages/react-scripts/config/webpack.config.dev.js
@@ -126,7 +126,7 @@ module.exports = {
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
- new ModuleScopePlugin(paths.appSrc),
+ new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
],
},
module: {
@@ -150,94 +150,85 @@ module.exports = {
enforce: 'pre',
include: paths.appSrc,
},
- // ** ADDING/UPDATING LOADERS **
- // The "file" loader handles all assets unless explicitly excluded.
- // The `exclude` list *must* be updated with every change to loader extensions.
- // When adding a new loader, you must add its `test`
- // as a new entry in the `exclude` list for "file" loader.
-
- // "file" loader makes sure those assets get served by WebpackDevServer.
- // When you `import` an asset, you get its (virtual) filename.
- // In production, they would get copied to the `build` folder.
- {
- exclude: [
- /\.html$/,
- // We have to write /\.(js|jsx)(\?.*)?$/ rather than just /\.(js|jsx)$/
- // because you might change the hot reloading server from the custom one
- // to Webpack's built-in webpack-dev-server/client?/, which would not
- // get properly excluded by /\.(js|jsx)$/ because of the query string.
- // Webpack 2 fixes this, but for now we include this hack.
- // https://github.com/facebookincubator/create-react-app/issues/1713
- /\.(js|jsx)(\?.*)?$/,
- /\.(ts|tsx)(\?.*)?$/,
- /\.css$/,
- /\.json$/,
- /\.bmp$/,
- /\.gif$/,
- /\.jpe?g$/,
- /\.png$/,
- ],
- loader: require.resolve('file-loader'),
- options: {
- name: 'static/media/[name].[hash:8].[ext]',
- },
- },
- // "url" loader works like "file" loader except that it embeds assets
- // smaller than specified limit in bytes as data URLs to avoid requests.
- // A missing `test` is equivalent to a match.
- {
- test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
- loader: require.resolve('url-loader'),
- options: {
- limit: 10000,
- name: 'static/media/[name].[hash:8].[ext]',
- },
- },
- // Compile .tsx?
- {
- test: /\.(ts|tsx)$/,
- include: paths.appSrc,
- loader: require.resolve('ts-loader'),
- },
- // "postcss" loader applies autoprefixer to our CSS.
- // "css" loader resolves paths in CSS and adds assets as dependencies.
- // "style" loader turns CSS into JS modules that inject