Commit Graph

193 Commits

Author SHA1 Message Date
Joe Haddad
27ac52ac2f Remove runtime alias hack (#5142)
* Remove runtime alias hack

* Pass absolute path to preset

* Change comment

* Give a relative path to absolute runtime

* Clean up config

* Tweak again

* Make absolute runtime the default

* Remove runtime package from error overlay
2018-09-27 16:52:43 -04:00
Joe Haddad
ce5a2e4e14 Adjust regex fed to RegExp
https://github.com/facebook/create-react-app/pull/4169#issuecomment-425145384
2018-09-27 11:56:42 -04:00
David Moodie
3b71621552 Workbox service worker (#4169)
* Add workbox service worker functionality

* Remove debug

* Set workboxConfig for when there isn't a cra config file

* Remove workbox configuration options as c-r-a isn't planning on supporting optional configuration

* Remove c-r-a config path from paths

* Add workbox service worker functionality

* Remove c-r-a config path from paths

* Inline the webpack workbox config

* Use settings reccommended by @jeffposnick

https://github.com/facebook/create-react-app/pull/4169/#issuecomment-422963072

* Fallback to public url index.html, not root

* Add one comment

* Update comment

* Correct regex
2018-09-27 11:51:42 -04:00
Joe Haddad
fed41009b6 Output CSS sourcemaps in separate file (#5131)
* Output CSS sourcemaps in separate file

* explain options
2018-09-27 09:13:27 -04:00
Marco Fugaro
1b57f0157b Remove highlightCode:true because it's now the default (#5085) 2018-09-27 00:20:42 -04:00
XiaoYan Li
46b18d9f36 Prevent Babel config overridden (#5109) 2018-09-26 17:03:31 -04:00
Joe Haddad
deffd04130 Fix babel runtime exclude rule 2018-09-26 01:31:50 -04:00
Joe Haddad
969fb37ea9 Disable source maps for node_modules (#5096) 2018-09-25 21:24:48 -04:00
Joe Haddad
adfb20c403 Turn on Babel helpers (#5093)
* Turn on helpers and test importing something with async/await works

* Compiling babel runtime breaks itself

* Add helpers option to babel plugin with defaults

* Make helpers off by default and on in our configuration

* Hit eject and e2e

* meh

* copy'n'paste

* change again

* Turn off helpers by default in /prod, /dev, /test

* oops

* Spread undefined

* Use object assign not object spread

* Put preset in template since it's needed

* Fix e2e tests
2018-09-25 18:59:06 -04:00
Joe Haddad
5599eff861 Drop IE 11 support by default (#5090)
* Drop ie 11 support and move polyfills to a new package

* More useful directions for what entry point to use
https://github.com/facebook/create-react-app/pull/5090#discussion_r220313783

* Clear up what file this polyfill goes in
https://github.com/facebook/create-react-app/pull/5090#discussion_r220313980

* Polyfill `window`, not `global`

* Remove proxy polyfill file
2018-09-25 16:08:29 -04:00
Joe Haddad
5f381e7646 Allow stage 3 css transforms (#5091)
* Switch to stage 3 css

* Tweak default browsers, too
2018-09-25 15:21:55 -04:00
Grady Kuhnline
fb6e6f70a3 Add postcss-preset-env, remove autoprefixer (#4716)
* add postcss-preset-env, remove autoprefixer

* limit to stage 4
2018-09-25 10:33:23 -04:00
Joe Haddad
11737bc786 Prevent the cache of files using Babel Macros (#5078)
* Add new overrides option

* Add file to package.json

* Create our own loader

* Remove overrides

* We have to use a real babel option

* Add comments
2018-09-24 20:10:11 -04:00
Joe Haddad
03a709195f Revert "Add loader for .graphql files (#3909)" (#5076) 2018-09-24 12:48:58 -04:00
Joe Haddad
2ee4fa8152 Add user defined proxy via middleware (#5073)
* Add user defined proxy via middleware

* Pass app, instead
2018-09-24 11:24:02 -04:00
Joe Haddad
2150693d6f Upgrade svgr to v2 and disable Prettier/SVGO (#5062) 2018-09-21 16:00:28 -04:00
Joe Haddad
e88809f489 Inline the webpack runtime chunk (#5058) 2018-09-21 14:17:56 -04:00
Jason Laster
78f0a96133 Switch back to cheap-module-source-map (#5059) 2018-09-21 13:47:59 -04:00
Joe Haddad
0cfe758f27 Ensure files get purged when they should (#5054) 2018-09-21 09:56:45 -04:00
Joe Haddad
74c4baebf2 Normalize babel caching across the board (#5053) 2018-09-21 09:19:29 -04:00
Jason Laster
2ed8eccf08 Switch to eval-source-map (#4930) 2018-09-20 18:54:50 -04:00
Joe Haddad
4abc5c4877 Always lint with latest React version (#5043)
This is the best behavior so people have seamless upgrades to new React majors.

This is probably a terrible default warning from the ESLint plugin, and we need to wait for https://github.com/yannickcr/eslint-plugin-react/issues/1955 before changing this hardcoded behavior.

Closes #5034
2018-09-20 11:58:27 -04:00
Joe Haddad
25ebe01399 Upgrade react-scripts dependencies (#5032)
* No lock files prevents the use of yarn upgrade & outdated

* Update deps

* Bump Jest across the board

* Add safe postcss parser
2018-09-19 14:44:08 -04:00
Jeffrey Posnick
1b2813144b Updates to reflect service worker registration being opt-in (#3924)
* Updates to reflect service worker registration being opt-in.

* Fixed an anchor link.

* Updates to SWPrecacheWebpackPlugin config, and corresponding docs.
2018-09-19 14:08:38 -04:00
Joe Haddad
c1ccbbc282 Upgrade html-webpack-plugin to fix tests (#5031)
* Upgrade html webpack plugin

* Fix build
2018-09-19 12:09:18 -04:00
Joe Haddad
d55525651f Disable webpack chunk coalescing (#5030)
* Disable webpack chunk rollup

* Bump timeout

* Revert "Bump timeout"

This reverts commit 84632115d178b48e08eb75dc5e9a921ece6aa759.
2018-09-19 09:43:57 -04:00
Joe Haddad
9bbc1775bb Remove mjs support (#5027)
* Revert Lerna dependency, there's too many bugs in v3

* Remove `mjs` support
2018-09-18 17:09:27 -04:00
Joe Haddad
50b4857ff8 Revert "Add support for yarn and lerna monorepos. (#3741)"
This reverts commit b43ad04b88.
2018-09-18 14:31:19 -04:00
Joe Haddad
10e8fd5531 Revert "Ensure workspaces key exists in parent package.json (#3989)"
This reverts commit 47d2d94118.
2018-09-18 14:31:19 -04:00
Joe Haddad
cc328d6287 Revert "Use yarn when running inside yarn workspace. (#3997)"
This reverts commit 2c34d5b66e.
2018-09-18 14:31:19 -04:00
Joe Haddad
2300f9e983 Switch from uglifyjs to terser (#5026)
Uglify is no longer maintained and has bugs not present in Terser (its successor)
2018-09-18 14:31:02 -04:00
Joe Haddad
22353ecf02 Fix ESLint output formatting
The `formatter` option is incompatible with with `thread-loader`.
The `formatter` option previously accepted a function which was lost during JSON serialization.
2018-09-17 19:59:14 -04:00
Jack Zhao
52449c34ee Only use safe options when packing CSS assets (#4706)
* support scoped packages for cra --scripts-version option

* enable safe option to cssnano processor

Fixes #4682
2018-07-23 01:22:05 -04:00
Miguel Palau
4a87838f52 remove extra dot on devtool link comment (#4741) 2018-07-05 12:40:55 -04:00
Dmitriy Sadkovoy
3e165448a7 Added thread-loader config for application code entrypoint (#4582) 2018-06-07 01:06:47 -06:00
Dmitriy Sadkovoy
d0afe4b3b9 Configured the thread-loader to keeping workers alive in development mode (#4562) 2018-06-05 18:27:34 +02:00
Jack Zhao
76ef9fadb6 Merge pull request #4014 from viankakrisna/enable-manifest-plugin-on-dev
enable manifest plugin on dev
2018-05-31 10:26:38 -07:00
Jack Zhao
581c453610 Scope hoisting in webpack 4 (#4504) 2018-05-24 18:32:06 -04:00
Graeme
61c864c38a Update paths.js, rename shadow path variable (#4435)
* Update paths.js, rename shadow path variable

This file requires the "path" module and sets it to a variable `path`. The function `ensureSlash` also has a variable `path` that then shadows the `path` module.

* Update paths.js
2018-05-22 21:11:20 -06:00
Jack Zhao
d1454febd1 Webpack4 (#4490)
* - [x] Upgrade to webpack 4.8.X
- [x] Utilize webpack 4 development and production modes
- [x] Upgrade webpack dev server
- [x] Webpack 4 compatible release of thread-loader
- [x] Webpack 4 compatible release of HtmlWebpackPlugin
- [x] Webpack 4 compatible release of SwPrecacheWebpackPlugin
- [x] Webpack 4 compatible release of WebpackManifestPlugin
- [x] Update README
- [x] Update WebpackDevServerUtils
- [x] Update InterpolateHtmlPlugin
- [x] Update ModuleScopePlugin
- [x] Update WatchMissingNodeModulesPlugin
- [x] Move UglifyJS options to webpack 4 optimize
- [x] Move InterpolateHtmlPlugin to make it tapable on HtmlWebpackPlugin
- [x] vendor splitting via splitChunks.splitChunks (https://twitter.com/wSokra/status/969633336732905474)
- [x] long term caching via splitChunks.runtimeChunk (https://twitter.com/wSokra/status/969679223278505985)
- [x] Make sure process.env.NODE_ENV is proxied correctly to `react-error-overlay`
- [x] Implicit webpack.NamedModulesPlugin in dev config as its default in webpack 4
- [x] Disable webpack performance hints as we have our own filesize reporter
- [x] Replace ExtractTextPlugin with MiniCssExtractPlugin
- [x] Switch to css whole file minification via OptimizeCSSAssetsPlugin rather than per module css minification to gain performance

* disable module concatenation

* fix cleanup

* fix optimization

* restore tmp removal

* preserve

* fix css tests

* fix test run

* fix svg test

* revert tmp dir

* fix import

* fix import

* help debugging

* fix tests

* fix sass test

* restore cleanup
2018-05-20 18:25:57 +01:00
Andreas Cederström
d72678fb0c - [x] Upgrade to webpack 4.8.X (#4077)
- [x] Utilize webpack 4 development and production modes
- [x] Upgrade webpack dev server
- [x] Webpack 4 compatible release of thread-loader
- [x] Webpack 4 compatible release of HtmlWebpackPlugin
- [x] Webpack 4 compatible release of SwPrecacheWebpackPlugin
- [x] Webpack 4 compatible release of WebpackManifestPlugin
- [x] Update README
- [x] Update WebpackDevServerUtils
- [x] Update InterpolateHtmlPlugin
- [x] Update ModuleScopePlugin
- [x] Update WatchMissingNodeModulesPlugin
- [x] Move UglifyJS options to webpack 4 optimize
- [x] Move InterpolateHtmlPlugin to make it tapable on HtmlWebpackPlugin
- [x] vendor splitting via splitChunks.splitChunks (https://twitter.com/wSokra/status/969633336732905474)
- [x] long term caching via splitChunks.runtimeChunk (https://twitter.com/wSokra/status/969679223278505985)
- [x] Make sure process.env.NODE_ENV is proxied correctly to `react-error-overlay`
- [x] Implicit webpack.NamedModulesPlugin in dev config as its default in webpack 4
- [x] Disable webpack performance hints as we have our own filesize reporter
- [x] Replace ExtractTextPlugin with MiniCssExtractPlugin
- [x] Switch to css whole file minification via OptimizeCSSAssetsPlugin rather than per module css minification to gain performance
2018-05-20 18:22:24 +01:00
William Chargin
3aaddefc51 ensureSlash: Fix accidental string-to-NaN coercion (#4424)
Summary:
The `hasSlash` method uses `path.substr(path, path.length - 1)` to
remove the last character from `path`. Clearly, the first parameter is
suspect; it should be `0`. The code works as written, but only very
accidentally: the first parameter is coerced by `ToNumber` to `NaN`,
which is then coerced by `ToInteger` to `+0`, per [the spec][1].

[1]: https://www.ecma-international.org/ecma-262/6.0/#sec-string.prototype.substr

Test Plan:
Reading the spec should be sufficient. To verify in the Real World:
```js
const path = "has-slash-but-does-not-need-slash/"
const a = path.substr(path, path.length - 1);
const b = path.substr(0, path.length - 1);
console.log(a === b);  // true
console.log(a);        // has-slash-but-does-not-need-slash
```

wchargin-branch: ensureslash-accidental-coercion
2018-05-08 19:31:25 -04:00
Andreas Cederström
cc36849ca8 fix broken css module support in prod (#4361) 2018-04-27 08:04:51 +02:00
Fabiano Brito
bf3d73c2c6 Add Sass loader (#4195)
* Installs and adds sass loader task in webpack for dev environment.

* Uses Timer's branch of sass-loader without node-sass dependency.

* Adds method for handling SASS modules.

* Fixes extension of excluded files when looking for scss modules.

* Adds support for both .scss and .sass extensions.

* Uses ExtractTextPlugin with sass-loader to bundle styles for the production build.

* Bundles SASS modules for the production build.

* Uses the latest version of sass-loader.

* Adds function to create different rules for style loaders in dev environment.

* Abstracts style loaders to a common function to avoid repetition.

* Simplifies the common function that creates style loaders.

* Creates assets for testing SASS/SCSS support.

* Creates mock components and unit tests for SASS and SCSS with and without modules.

* Creates integration tests for SASS/SCSS support.

* Adds node-sass as a template dependency so sass-loader can be tested.

* Includes sass tests when test component is mounted.

* Fixes asserted module name for sass and scss modules tests.

* Removes tests against css imports in SCSS and SASS files.

* Updates sass-loader to v7.

* Uses getCSSModuleLocalIdent from react-dev-utils.

* Fixes tests to match the use of getCSSModuleLocalIdent.

* Improves readability of getStyleLoader function.

* Uses postcss after sass.

* Refactors dev config to simplify common function for style loaders.

* Refactors prod config to simplify common function for style loaders.

* Use importLoaders config according to css-loader docs.
2018-04-18 10:35:55 -06:00
Ro Savage
ae2cf07249 Update CSS Modules localIndetName (#4192)
* Update CSS Modules localIndetName

* Add missing file to package

* Correct regex

* plz plz plz
2018-04-13 16:14:31 -04:00
Daniel
9a99b5d190 Fix typo and be clearer about ecma settings in uglifyjs options (#4239) 2018-04-02 15:17:24 -04:00
Daniel
2824bf2e15 [next] Revert to use ecma 5 in uglifyOptions (#4234)
* Revert to use ecma 5 in uglifyOptions

* remove explicit ecma version from uglifyOptions settings

The defaults are already what we want

* be explicit of where we use ecma: 8 and ecma: 5
2018-04-02 13:30:30 -04:00
Ade Viankakrisna Fadlil
f17914c33c enable manifest plugin on dev 2018-02-11 19:33:03 +07:00
bradfordlemley
2c34d5b66e Use yarn when running inside yarn workspace. (#3997)
* Run yarn after ejecting.

* On eject, choose to run yarn instead of npm if yarn is available.

* Move monorepo to react-dev-utils.

* Fix lint.

* Rename monorepo to workspaceUtils.

* Add react-dev-utils dep for create-react-app.

* getMonorepo -> findMonorepo
2018-02-10 13:07:19 +00:00
Robin van der Vleuten
aaf022ca39 Set the public path to the asset manifest entries (#2544) 2018-02-09 13:14:14 +00:00