A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)
OTHER License
Bot releases are visible (Hide)
Fixed:
nwb react
, nwb preact
and nwb inferno
quick development commands.nwb preact
commands and nwb react
's --preact[-compat]
when used with Preact 8 by removing a workaround for an old preact-compat distribution issue.Added:
Dependencies:
Breaking Changes:
Global react
, preact
, and inferno
commands are no longer installed when nwb is installed globally [#308]
These are now subcommands of the global nwb
command, to avoid conflicting with global commands installed by official tools for these libraries, e.g. preact-cli
is now available, which provides a global preact
command.
Node.js v4.6.0 is now the minimum required version, based on the engines
config of nwb's dependencies,
A separate Webpack rule for stylesheets imported from node_modules/
is no longer created by default.
For backwards compatibility you can set
webpack.style
config to'old'
to use the old default behaviour - this capability will be removed in a future release.
The Babel plugin for Inferno now requires Inferno >= 1.5 and is not backwards-compatible with 1.4.
Default Webpack config now sets module.strictExportPresence = true
so a missing export is now a compile error.
Added:
You can now control how Webpack rules are created for stylesheets via webpack.styles
config.
This allows you to set up multiple rules for your own stylesheets (e.g. using CSS Modules only for stylesheets in a particular directory) and to provide rules for dependencies which need a specific Webpack rule for their stylesheets.
You can also disable creation of stylesheet rules by setting webpack.styles
to false
.
Re-enabled the react-constant-elements
transform for React production builds, due to significant bug fixes.
Added a --no-hmre
flag for use when serving a React app, to disable use of React Transform to attempt to automatically handle Hot Module Replacement for React components and display an overlay with render()
errors [#263]
Added support for intl and react-intl in webpack.compat
config [#260] [grahamlyus]
You can now provide a webpack.config()
function which will be given the generated Webpack config to do whatever it wants with [#256]
You can now provide use
config with a list of loaders in webpack.rules
to replace a rule's default loader with chained loaders [#256]
You can now disable a default Webpack config rule by setting it to false
[#256]
Changed:
loader
for a rule in webpack.rules
[#256]React.Component
instead of React.createClass()
, which is deprecated as of React v15.5 [#216]Fixed:
webpack-md5-hash
plugin [#301] [grahamlyus]CopyWebpackPlugin
when serving a react-component
project's demo app, so any static content in demo/public/
will be also served by the dev server [#307]node_modules/
caching from default Travis CI config in project skeletons, as it's been reported to cause build failures [#271]loader
configured for a Webpack rule is no longer moved into the options
object when an options object hasn't been explicitly configured [#256]demo/dist/
dir.Dependencies:
React.createClass()
in favour of the new create-react-class
packagealias
option
useRelativePath
optionwarn()
and info()
utilitiesimport()
can now configure a chunk name, require.ensure()
can now take an error callback, added module.strictExportPresence
#webpack-hot-middleware-clientOverlay
Internal:
fs
and fs-extra
instead of glob
and rimraf
, which are now only devDependencies
.This release fixes dependency issues from v0.15.7
Dependencies:
Added:
npm.cjs
config to disable creation of a CommonJS build in lib/
if you don't need it [#285] [treshugart]Changed:
webpack.uglify
config is false
[#288] [treshugart]customLaunchers
which start with "Chrome" [#296] [michaelsbradleyjr]Fixed:
Docs:
usePolling
config to reduce CPU usage on macOS [#297] [michaelsbradleyjr]Changed:
process.exit(0)
from the nwb
command when there are no errors running a command [#262]Fixed:
peerDependency
in new react-component
projects.
getstorybook
now works in a new react-component
project againpreact-compat
for compatibility builds using react build
with the --preact
flag, to prevent UglifyJS errors [#244]Changed:
Support the Array version of deprecated webpack.postcss
config.
Tell the user they're including redundant config if they've manually configured inferno-compat or preact-compat aliases for React modules [#247]
Fixed:
Added a missing .default
to the Preact project skeleton where CommonJS require()
was being used to import an ES module [#245]
.default
must now be used to access the default export from an ES module when importing with CommonJS require()
as Webpack 2 prevents module format mixing, which was previously used to provide CommonJS interop.
Fixed:
preact-compat
, as UglifyJS can't handle the ES module
build [#244]Breaking Changes:
Upgraded from Webpack 1 to Webpack 2 [#110]
Minimum Node.js version increased from 4.2 to 4.3 - this is Webpack 2's minimum supported Node.js version.
Strict Webpack configuration - Webpack 2 is strict about what appears in its configuration object. If you're using webpack.extra
config, it must conform to Webpack 2's configuration format or your build will fail with a validation error.
Dropped CommonJS compatibility when importing ES modules - Webpack 2 no longer allows you to mix CommonJS modules with ECMAScript modules - if a module uses import
or export
syntax, exports
will be undefined
and module.exports
will be read-only and undefined
.
As a result, we can no longer provide CommonJS interop by default for ES Modules - you will need to check your code for usage of CommonJS require()
to import ES modules and tack a .default
on the end if you need to use the module's export default
.
If you used nwb's Preact project skeleton, the
init()
function inindex.js
needs to have a.default
tacked on when theApp
component is being imported.
Custom top-level properties no longer allowed in Webpack configuration - Webpack 2 no longer allows custom top-level properties in its configuration. Loader configuration which can't be serialised, such as plugin objects, can now be provided directly as loader options instead using webpack.rules
config instead.
This includes postcss-loader
, which is now configured via webpack.rules
instead of having its own special webpack.postcss
config.
nwb.config.js
Config Format Changes:
For deprecations, nwb will continue to support the old format for the next couple of releases, displaying warning messages about the changes required and adapting deprecated config for use in the current version where possible.
If you have an
nwb.config.js
file, runnwb check-config
after updating nwb to find out if there's anything you need to change.
Deprecated karma.testDirs
, renaming this config to karma.excludeFromCoverage
, as it can be configured to exclude any paths from code coverage, not just directories [#236]
// < v0.15 // v0.15
module.exports = { module.exports = {
karma: { karma: {
testDirs: [ => excludeFromCoverage: [
'test/', 'test/',
'path/to/ignorethis.js' 'path/to/ignorethis.js'
] ]
} }
} }
Deprecated webpack.loaders
, renaming this config to webpack.rules
to match Webpack 2's new config format:
// < v0.15 // v0.15
module.exports = { module.exports = {
webpack: { webpack: {
loaders: { => rules: {
/* ... */ /* ... */
} }
} }
} }
Deprecated use of a query
property to configure Webpack rule options as a separate object - an options
property should now be used as per Webpack 2's new config format:
// < v0.15 // v0.15
module.exports = { module.exports = {
webpack: { webpack: {
loaders: { rules: {
css: { css: {
query: { => options: {
modules: /* ... */ modules: /* ... */
} }
} }
} }
} }
} }
You can also still configure loader options as a flat object to make this particular change irrelevant:
module.exports = {
webpack: {
rules: {
css: {
modules: /* ... */
}
}
}
}
Deprecated configuring PostCSS plugins with special webpack.postcss
config - postcss-loader can now be configured like any other loader using webpack.rules
config:
// < v0.15 // v0.15
module.exports = { module.exports = {
webpack: { webpack: {
postcss: [ => rules: {
require('precss')(), postcss: {
require('autoprefixer')() plugins: [
] require('precss')(),
} require('autoprefixer')()
} ]
}
}
}
}
Removed:
json-schema
in webpack.compat
config, as this library has now been fixed [#227]Dependencies:
createVNode
Temporarily Scoped Dependencies:
These are being scoped to both make use of unreleased features and to test them out:
Internal:
fs-extra
dependency.babel-preset-env
when transpiling to lib/
, targeting Node.js v4 [#233]String
methods available in Node.js v4 instead of String.prototype.indexOf
comparisons [#222]Fixed:
This release brings support for Preact and Inferno up to parity with support for React, with new preact
and inferno
commands to match react
, and Express middleware support for running development builds with them on your own server.
Quick development commands are now much better at installing dependencies nwb can determine you'll need up front. They can also now use style preprocessor plugins without having to introduce a package.json
and have more flags to prevent you from having to reach for a config file.
Fixed:
nwb
, it will now exit with a warning if the project specifies a different version of nwb in package.json
[#167]
build
, serve
etc. from a global nwb
install is provided so you don't have to reinstall the entirety of nwb when creating new projects, but it's recommended that you switch to a locally-installed version later, as relying on globally-installed tool versions is brittle.clean
commands in paths with spaces [#181]Added:
inferno
command for quick Inferno prototyping and building. Use inferno run <entry.js>
to serve a module and inferno build <entry.js> [dist/]
to build it.preact
command for quick Preact prototyping and building. Use preact run <entry.js>
to serve a module and preact build <entry.js> [dist/]
to build it.inferno
and preact
commands use a render shim module by default which hooks into Inferno.render()
and Preact.render()
to intercept the incoming VNode and re-render it from the top when accepting Hot Module Replacement, so if you're calling render()
yourself you don't have to specify a DOM node, or a root
when re-rendering in Preact.
--force
flag and nwb will skip the render shim and use your entry module directly.react
command's render shim doesn't hook into ReactDOM.render()
and only handles rendering exported components or elements for convenient prototyping, as react-transform-hmr handles the details of accepting Hot Module Replacement and patching/re-rendering at the component/module level.inferno
and preact
commands to the existing react
command:
--plugins
option to specify nwb plugins which should be installed and used without having to set up a package.json
.--force
option to force use of the provided entry module directly instead of the render shim module which is used by default to support quick prototyping.--no-polyfill
option to disable inclusion of nwb's default polyfills for Promise
, fetch
and Object.assign
if you're not using them or don't need them polyfilled.react build
can now build a module which exports a React component or element, for quick sharing of prototypes.react
or react-dom
are imported, allowing use of existing React code out of the box.Changed:
index.html
) - you will need to include this first if manually handling HTML generation after building.--inferno
or --preact
flags, the required compatibility dependencies are now installed automatically if they can't be resolved from your project directory..git/
directory already exists, e.g. you may want to use nwb init
in an existing repo.demo/public/
directory for static content.args
property is now included in the object passed to user configs which export a function - this contains parsed arguments, e.g. args.preact
will be true
if you passed --preact
when calling nwb
.Removed:
--set-env-VAR_NAME
arguments to set environment variables.jsnext:main
is no longer included package.json
for new react-component
and web-module
projects - only the "more standard" module
property is used to point to an ES2015 modules build [#215]Dependencies:
Fixed:
Don't configure the babel runtime transform's moduleName
path when transpiling code for npm [#205]
If you depend on babel-runtime
in a React component or Web module (by using async
/await
or enabling any of the runtime transform's other features) it needs to be resolvable from the end-user's dependencies, so should be added to your project's peerDependencies
.
Fixed:
Fixed:
preact-app
template [#206 by @ntwcklng]