Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

fixed merge typo in ISSUE_TEMPLATE.md #147

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
8 changes: 2 additions & 6 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,11 @@
Please fill in all the relevant fields by running these commands in terminal.
-->

1. `npm ls react-scripts-ts` (if you haven’t ejected):
1. `npm ls react-scripts-ts-component` (if you haven’t ejected):
2. `node -v`:
3. `npm -v`:
4. `yarn --version` (if you use Yarn):
<<<<<<< HEAD
5. `npm ls react-scripts` (if you haven’t ejected):
=======
3. `npm ls react-scripts-ts` (if you haven’t ejected):
>>>>>>> Fix Code Review
3. `npm ls react-scripts-ts-component` (if you haven’t ejected):

Then, specify:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ _Do you know react and want to try out typescript? Or do you know typescript and
```sh
npm install -g create-react-app

create-react-app my-app --scripts-version=react-scripts-ts
create-react-app my-app --scripts-version=react-scripts-ts-component
cd my-app/
npm start
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ switch (script) {
}
default:
console.log('Unknown script "' + script + '".');
console.log('Perhaps you need to update react-scripts-ts?');
console.log('Perhaps you need to update react-scripts-ts-component?');
break;
}
15 changes: 9 additions & 6 deletions packages/react-scripts/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ function getServedPath(appPackageJson) {
// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appBuild: resolveApp('build'),
appBuild: resolveApp('dist'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appHtml: resolveApp('public/dev.html'),
appDevJs: resolveApp('src/dev.tsx'),
appIndexJs: resolveApp('src/index.tsx'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
Expand All @@ -72,9 +73,10 @@ const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp('build'),
appBuild: resolveApp('dist'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appHtml: resolveApp('public/dev.html'),
appDevJs: resolveApp('src/dev.tsx'),
appIndexJs: resolveApp('src/index.tsx'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
Expand Down Expand Up @@ -104,9 +106,10 @@ if (
module.exports = {
dotenv: resolveOwn('template/.env'),
appPath: resolveApp('.'),
appBuild: resolveOwn('../../build'),
appBuild: resolveOwn('../../dist'),
appPublic: resolveOwn('template/public'),
appHtml: resolveOwn('template/public/index.html'),
appHtml: resolveOwn('template/public/dev.html'),
appDevJs: resolveOwn('template/src/dev.tsx'),
appIndexJs: resolveOwn('template/src/index.tsx'),
appPackageJson: resolveOwn('package.json'),
appSrc: resolveOwn('template/src'),
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = {
// Errors should be considered fatal in development
require.resolve('react-error-overlay'),
// Finally, this is your app's code:
paths.appIndexJs,
paths.appDevJs,
// We include the app code last so that if there is a runtime error during
// initialization, it doesn't blow up the WebpackDevServer client, and
// changing JS code would still trigger a refresh.
Expand Down
71 changes: 18 additions & 53 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (env.stringified['process.env'].NODE_ENV !== '"production"') {
}

// Note: defined here because it will be used more than once.
const cssFilename = 'static/css/[name].[contenthash:8].css';
const cssFilename = '[name].css';

// ExtractTextPlugin expects the build output to be flat.
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
Expand All @@ -63,23 +63,35 @@ module.exports = {
// You can exclude the *.map files from the build during deployment.
devtool: 'source-map',
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
entry: {
index: [require.resolve('./polyfills'), paths.appIndexJs]
},
output: {
// The build folder.
path: paths.appBuild,
// Generated JS file names (with nested folders).
// There will be one main bundle, and one file per asynchronous chunk.
// We don't currently advertise code splitting but Webpack supports it.
filename: 'static/js/[name].[chunkhash:8].js',
chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
filename: '[name].js',
chunkFilename: '[name].[chunkhash:8].chunk.js',
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: publicPath,
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: info =>
path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/'),
libraryTarget: 'umd',
},
target: 'node',
externals: [
'react',
'react-dom',
'whatwg-fetch',
'object-assign',
'promise/lib/es6-extensions.js',
'promise/lib/rejection-tracking',
],
resolve: {
// This allows you to set a fallback for where Webpack should look for modules.
// We placed these paths second because we want `node_modules` to "win"
Expand Down Expand Up @@ -172,7 +184,7 @@ module.exports = {
],
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]',
name: 'media/[name].[hash:8].[ext]',
},
},
// "url" loader works just like "file" loader but it also embeds
Expand All @@ -182,7 +194,7 @@ module.exports = {
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]',
name: 'media/[name].[hash:8].[ext]',
},
},
// Compile .tsx?
Expand Down Expand Up @@ -256,23 +268,6 @@ module.exports = {
// In production, it will be an empty string unless you specify "homepage"
// in `package.json`, in which case it will be the pathname of that URL.
new InterpolateHtmlPlugin(env.raw),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml,
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
// It is absolutely essential that NODE_ENV was set to production here.
Expand Down Expand Up @@ -306,36 +301,6 @@ module.exports = {
new ManifestPlugin({
fileName: 'asset-manifest.json',
}),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the Webpack build.
new SWPrecacheWebpackPlugin({
// By default, a cache-busting query parameter is appended to requests
// used to populate the caches, to ensure the responses are fresh.
// If a URL is already hashed by Webpack, then there is no concern
// about it being stale, and the cache-busting can be skipped.
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: 'service-worker.js',
logger(message) {
if (message.indexOf('Total precache size is') === 0) {
// This message occurs for every build and is a bit too noisy.
return;
}
if (message.indexOf('Skipping static resource') === 0) {
// This message obscures real errors so we ignore it.
// https://github.com/facebookincubator/create-react-app/issues/2612
return;
}
console.log(message);
},
minify: true,
// For unknown URLs, fallback to the index page
navigateFallback: publicUrl + '/index.html',
// Ignores URLs starting from /__ (useful for Firebase):
// https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219
navigateFallbackWhitelist: [/^(?!\/__).*/],
// Don't precache sourcemaps (they're large) and build asset manifest:
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
Expand Down
Loading