Skip to content

Commit

Permalink
Breaking: Drop support for Node.js 8 - Node.js 10.13.0 is now the min…
Browse files Browse the repository at this point in the history
…imum required version - closes #547

Breaking: Remove support for deprecated babel.stage and webpack.uglify config
Breaking: Remove default polyfills for Promise, fetch() and Object.assign() - import react-app-polyfill in your app if you need polyfills
Update dependencies which have dropped Node 8
  • Loading branch information
insin committed May 16, 2020
1 parent cdab645 commit bf05318
Show file tree
Hide file tree
Showing 26 changed files with 48 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ sudo: false

language: node_js
node_js:
- 8
- 10
- 12
- 14

cache:
directories:
Expand Down
21 changes: 21 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# `next` branch

## Breaking Changes

- Node.js 8 is no longer supported; Node.js 10.13.0 is now the minimum required version, as per many of nwb's dependencies.
- Removed support for deprecated `babel.stage` and `webpack.uglify` config.
- Removed default polyfills for `Promise`, `fetch()` and `Object.assign()` and deprecated `polyfill` config.
- If you need to support older browsers, you will need to provide the necessary polyfills yourself.
- The [react-app-polyfill](https://github.com/facebook/create-react-app/tree/master/packages/react-app-polyfill#react-app-polyfill) module provides polyfills for IE 9-11, and for stable language features - its instructions also work for apps using nwb.
- file-loader v6.0.0 [changed its default hashing algorithm](https://github.com/webpack-contrib/file-loader/blob/master/CHANGELOG.md#600-2020-03-17).

## Dependencies

- chalk: v3.0.0 → [v4.0.0](https://github.com/chalk/chalk/releases/tag/v4.0.0)
- file-loader: v4.3.0 → [v6.0.0](https://github.com/webpack-contrib/file-loader/blob/master/CHANGELOG.md#600-2020-03-17)
- fs-extra: v8.1.0 → [v9.0.0](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md#900--2020-03-19)
- karma: v4.4.1 → [v5.0.5](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md#505-2020-05-07)
- karma-mocha: v1.3.0 → [v2.0.1](https://github.com/karma-runner/karma-mocha/blob/master/CHANGELOG.md#201-2020-04-29)
- terser-webpack-plugin v2.3.6 → [v3.0.1](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md#301-2020-05-06)
- url-loader: v2.3.0→ [v4.1.0](https://github.com/webpack-contrib/url-loader/blob/master/CHANGELOG.md)

# 0.24.7 / 2020-05-16

## Fixed
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ branches:

environment:
matrix:
- nodejs_version: "8"
- nodejs_version: "12"

install:
- ps: Install-Product node $env:nodejs_version x64
Expand Down
17 changes: 0 additions & 17 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ The configuration object can include the following properties:

- nwb Configuration
- [`type`](#type-string-required-for-generic-build-commands)
- [`polyfill`](#polyfill-boolean) - control automatic polyfilling
- [Babel Configuration](#babel-configuration)
- [`babel`](#babel-object)
- [`babel.cherryPick`](#cherrypick-string--arraystring) - enable cherry-picking for destructured `import` statements
Expand Down Expand Up @@ -140,18 +139,6 @@ If configured, it must be one of the following:
- `'web-app'`
- `'web-module'`

#### `polyfill`: `Boolean`

For apps, nwb will provide polyfills for `Promise`, `fetch` and `Object.assign` by default.

To disable this, set `polyfill` to `false`:

```js
module.exports = {
polyfill: false
}
```

### Babel Configuration

#### `babel`: `Object`
Expand Down Expand Up @@ -378,10 +365,6 @@ module.exports = {
}
```

##### `stage`: `Number | false`

*deprecated in v0.24.0 - use [`babel.proposals` config](#proposals-object--false) instead*

##### `config`: `Function`

Finally, if you need *complete* control, provide a `babel.config()` function which will be given the generated config.
Expand Down
4 changes: 0 additions & 4 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ If you only need CSS Modules for some of the stylesheets you'll be importing, yo

### What can I configure to reduce bundle size?

#### Disable default polyfills

If you don't need the `Promise`, `fetch` and `Object.assign` polyfills nwb provides by default, configuring [`polyfill: false`](/docs/Configuration.md#polyfill-boolean) (or passing a [`--no-polyfill` flag](/docs/guides/QuickDevelopment.md#options-for-run-and-build-commands) when using Quick Development commands) will shave ~4KB off the gzipped vendor bundle.

#### Enable cherry-picking for destructuring imports

If you're using destructuring imports with libraries like React Router and React Bootstrap (e.g. `import {Button} from 'react-bootstrap'`), you're bundling the whole library, instead of just the bits you need.
Expand Down
1 change: 0 additions & 1 deletion docs/Features.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- Provides tooling for [React](https://facebook.github.io/react/) apps and components, [Preact](https://preactjs.com/) apps, [Inferno](https://infernojs.org/) apps, and vanilla JS web apps and npm modules.
- Use modern JavaScript features, and JSX.
- Use proposed JavaScript features now.
- Default polyfills and configuration allow use of [`Promise`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise) (with [rejection tracking](https://www.2ality.com/2016/04/unhandled-rejections.html) enabled), [`fetch()`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API), [`async`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)/[`await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await), [generators](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/function*) and [`Object.assign()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) in any browser.
- Import CSS (and font resources) and images to be managed by Webpack.
- [Autoprefixed](https://github.com/postcss/autoprefixer#autoprefixer-) CSS, so you don't need to write browser prefixes; you can also configure your own [PostCSS](https://postcss.org/) plugins.
- Plugin modules which add support for the [Sass](https://github.com/insin/nwb-sass), [Less](https://github.com/insin/nwb-less) and [Stylus](https://github.com/insin/nwb-stylus) stylesheet languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ module.exports = {

#### Automatic Babel Polyfill

A context module is commonly used to load polyfills to allow tests to run in browsers missing certain features, but you don't need to worry about that if you were just going to use `babel-polyfill` - nwb automatically injects Babel's polyfill into Karma tests for you.
A context module is commonly used to load polyfills to allow tests to run in browsers missing certain features, but you don't need to worry about that if you were just going to use `@babel/polyfill` - nwb automatically injects Babel's polyfill into Karma tests for you.

#### Configuring Testing Libraries

Expand Down
5 changes: 0 additions & 5 deletions docs/guides/QuickDevelopment.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ Don't use a rendering shim, run the provided entry module directly - see [Opting

The default HTML template provided contains a `<div>` which the app is rendered into, with a default `id` of `'app'`. You can change the `id` with this setting.

#### `--no-polyfill`

Disable inclusion of nwb's default polyfills for `Promise`, `fetch()` and `Object.assign()` - you can use this to shave a few KB off the final bundle size if you're not using these features, are only supporting browsers which support them natively, or would prefer to provide your own polyfills, etc.

#### `--title`

Contents for `<title>` - defaults to the type of app you're serving, e.g. `'Preact App'`
Expand Down Expand Up @@ -177,7 +173,6 @@ Create a build of a React project which uses Inferno or Preact as the runtime vi
- Decorators.
- Export extensions.

- Polyfills for `Promise`, `fetch()` and `Object.assign()`, which can be disabled with a `--no-polyfill` flag if you don’t need them or want to provide your own.
- Import images and stylesheets into JavaScript like any other module, to be handled by Webpack as part of its build.

```js
Expand Down
1 change: 0 additions & 1 deletion docs/guides/ReactApps.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ Without any configuration, the main features you get are:
- Use proposed JavaScript features which make writing React apps more convenient:
- Class properties, for avoiding boilerplate when writing classes.
- Decorators, for libraries which are intended to be used with them.
- Polyfills for `Promise`, `fetch` and `Object.assign`.
- Import stylesheets (and font resources), images and JSON into JavaScript, to be handled by Webpack.
- Autoprefixed CSS, so you don't need to write browser prefixes.

Expand Down
20 changes: 8 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
"polyfills.js"
],
"engines": {
"node": ">=8.9.0"
"node": ">=10.13.0"
},
"dependencies": {
"chalk": "3.0.0",
"chalk": "4.0.0",
"copy-template-dir": "1.4.0",
"cross-spawn": "7.0.2",
"debug": "4.1.1",
"detect-port": "1.3.0",
"figures": "3.2.0",
"filesize": "6.1.0",
"fs-extra": "8.1.0",
"fs-extra": "9.0.0",
"gzip-size": "5.1.1",
"inquirer": "7.1.0",
"minimist": "1.2.5",
Expand Down Expand Up @@ -67,10 +67,10 @@
"babel-preset-proposals": "0.3.0",
"react-refresh": "0.8.2",

"karma": "4.4.1",
"karma": "5.0.5",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.0.2",
"karma-mocha": "1.3.0",
"karma-mocha": "2.0.1",
"karma-mocha-reporter": "2.2.5",
"karma-phantomjs-launcher": "1.0.4",
"karma-sourcemap-loader": "0.3.7",
Expand All @@ -80,27 +80,23 @@
"mocha": "7.1.2",
"expect": "1.20.2",

"object-assign": "4.1.1",
"promise": "8.1.0",
"whatwg-fetch": "3.0.0",

"webpack": "4.43.0",
"autoprefixer": "9.7.6",
"babel-loader": "8.1.0",
"case-sensitive-paths-webpack-plugin": "2.3.0",
"copy-webpack-plugin": "5.1.1",
"css-loader": "3.5.3",
"eventsource-polyfill": "0.9.6",
"file-loader": "4.3.0",
"file-loader": "6.0.0",
"html-webpack-plugin": "4.3.0",
"mini-css-extract-plugin": "0.9.0",
"@insin/npm-install-webpack-plugin": "5.0.0",
"optimize-css-assets-webpack-plugin": "5.0.3",
"open": "7.0.4",
"postcss-loader": "3.0.0",
"style-loader": "1.2.1",
"terser-webpack-plugin": "2.3.6",
"url-loader": "2.3.0",
"terser-webpack-plugin": "3.0.1",
"url-loader": "4.1.0",
"webpack-dev-middleware": "3.7.2",
"webpack-dev-server": "3.11.0",
"webpack-hot-middleware": "2.25.0"
Expand Down
17 changes: 0 additions & 17 deletions polyfills.js

This file was deleted.

4 changes: 0 additions & 4 deletions src/appCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export function createBuildConfig(args: Object, extra: Object = {}) {
config.plugins.copy = [{from: path.resolve('public'), to: dist, ignore: ['.gitkeep']}]
}

if (args.polyfill === false || args.polyfills === false) {
config.polyfill = false
}

return merge(config, extra)
}

Expand Down
2 changes: 0 additions & 2 deletions src/commands/inferno.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Commands:
${opt('--host')} hostname to bind the dev server to
${opt('--mount-id')} id for the <div> the app will render into ${opt('[default: app]')}
${opt('--no-fallback')} disable serving of the index page from any path
${opt('--no-polyfill')} disable inclusion of default polyfills
${opt('--port')} port to run the dev server on ${opt('[default: 3000]')}
${opt('--reload')} auto reload the page if hot reloading fails
${opt('--title')} contents for <title> ${opt('[default: Inferno App]')}
Expand All @@ -70,7 +69,6 @@ Commands:
Options:
${opt('--force')} don't shim rendering, use the given entry module directly
${opt('--mount-id')} id for the <div> the app will render into ${opt('[default: app]')}
${opt('--no-polyfill')} disable bundling of default polyfills
${opt('--title')} contents for <title> ${opt('[default: Inferno App]')}
${opt('--vendor')} create a 'vendor' bundle for node_modules/ modules
`)
Expand Down
2 changes: 0 additions & 2 deletions src/commands/preact.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Commands:
${opt('--host')} hostname to bind the dev server to
${opt('--mount-id')} id for the <div> the app will render into ${opt('[default: app]')}
${opt('--no-fallback')} disable serving of the index page from any path
${opt('--no-polyfill')} disable inclusion of default polyfills
${opt('--port')} port to run the dev server on ${opt('[default: 3000]')}
${opt('--reload')} auto reload the page if hot reloading fails
${opt('--title')} contents for <title> ${opt('[default: Preact App]')}
Expand All @@ -70,7 +69,6 @@ Commands:
Options:
${opt('--force')} don't shim rendering, use the given entry module directly
${opt('--mount-id')} id for the <div> the app will render into ${opt('[default: app]')}
${opt('--no-polyfill')} disable bundling of default polyfills
${opt('--title')} contents for <title> ${opt('[default: Preact App]')}
${opt('--vendor')} create a 'vendor' bundle for node_modules/ modules
`)
Expand Down
2 changes: 0 additions & 2 deletions src/commands/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Commands:
${opt('--mount-id')} id for the <div> the app will render into ${opt('[default: app]')}
${opt('--no-fallback')} disable serving of the index page from any path
${opt('--no-hmr')} disable use of Fast Refresh for Hot Module Replacement
${opt('--no-polyfill')} disable inclusion of default polyfills
${opt('--port')} port to run the dev server on ${opt('[default: 3000]')}
${opt('--reload')} auto reload the page if hot reloading fails
${opt('--title')} contents for <title> ${opt('[default: React App]')}
Expand All @@ -71,7 +70,6 @@ Commands:
Options:
${opt('--force')} don't shim rendering, use the given entry module directly
${opt('--mount-id')} id for the <div> the app will render into ${opt('[default: app]')}
${opt('--no-polyfill')} disable bundling of default polyfills
${opt('--title')} contents for <title> ${opt('[default: React App]')}
${opt('--vendor')} create a 'vendor' bundle for node_modules/ modules
Expand Down
2 changes: 0 additions & 2 deletions src/commands/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Commands:
${opt('--mount-id')} id for the <div> in the default HTML ${opt('[default: app]')}
${opt('--no-fallback')} disable serving of the index page from any path
${opt('--no-reload')} disable auto reloading on changes
${opt('--no-polyfill')} disable inclusion of default polyfills
${opt('--port')} port to run the dev server on ${opt('[default: 3000]')}
${opt('--title')} contents for <title> ${opt('[default: Web App]')}
Expand All @@ -68,7 +67,6 @@ Commands:
Options:
${opt('--mount-id')} id for the <div> in the default HTML ${opt('[default: app]')}
${opt('--no-polyfill')} disable bundling of default polyfills
${opt('--title')} contents for <title> ${opt('[default: Web App]')}
${opt('--vendor')} create a 'vendor' bundle for node_modules/ modules
`)
Expand Down
Loading

0 comments on commit bf05318

Please sign in to comment.