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 hidden (Show)
nwb.config.js
Config Changeswebpack.compat.enzyme
flag for Enzyme v2 compatibility settings. Upgrade to Enzyme v3 when you can, which supports React all the way back to v0.13.
'createClass'
and 'createReactClass'
to the factory function names React Transform looks for, so React component hot reloading will work for apps using create-react-class
, imported as one of those names.webpack.compat.enzyme
config in v0.19.0, as it only applied while the version numbers of published React packages were out of sync. The compatibility settings assume Enzyme v2 and React >= v15.5.style-loader
's new hmr
option is set to false
when creating builds to prevent inclusion of its HMR code.render()
functions in quick commands, as this won't work with ES modules builds (which are used by default in Webpack v3). This affected the current version of Preact at the time of writing.
render()
with quick commands, you must now handle providing the target DOM node too - document.getElementById('app')
is available in the default HTML template.babel.env
config to pass additional options for babel-preset-env
.webpack.compat
for recent versions of React 15.babel-preset-env
instead of deprecated babel-preset-es201X
presets [#375]beautify: true
for webpack.debug
output so code split bundles are readable.React.PureComponent
to the list of default super classeswebpack.extractText
config to false
to disable extraction of stylesheets in builds [#343]webpack.extractText
config.Backported fixes from 0.18:
@import
in CSS by adding ident
back to postcss-loader
config [#311]webpack.styles
rule.@import
in CSS by adding ident
back to postcss-loader
config [#311]webpack.styles
config for custom preprocessor plugin rules [#342]webpack.styles
rule.Added webpack.debug
config to trigger creation of a more debuggable production build [#336]
The recommended way to use this is via a config argument:
npm run build -- --webpack.debug
Added support for the following arguments when building a React component's demo:
--title
- set the generated demo index.html
's <title>
--vendor
- enable creation of a vendor bundle for modules imported from node_modules/
[#335].babelrc
for cache identifier when babelrc=false
(nwb uses this option)ExtractTextPlugin
Backported fixes from 0.18:
NODE_ENV = production
was applied, so output filenames didn't include a chunkhash by default.webpack.styles
config for custom preprocessor plugin rules.build
command config was being created before the default NODE_ENV = production
was applied, so output filenames didn't include a chunkhash by default.Updated to Webpack 3 - potentially breaking for some plugins [#326]
See the official release post for changes.
Removed support for configuration which was deprecated in nwb v0.15.0.
Added webpack.hoisting
config to enable use of Webpack 3's new ModuleConcatenationPlugin
for scope hoisting in production builds [#326]
babel
, webpack
, devServer
, karma
and npm
configuration can now be provided via arguments using dotted paths [#327]
nwb react build app.js \
--babel.plugins=react-html-attrs \
--babel.stage=2 \
--webpack.hoisting
If you have a config file, arguments will override properties in it. This is primarily intended for one-off feature toggles without having to edit your config file, and to provide some level of configuration for quick development commands without needing a config file.
babel.plugins
, babel.presets
and locales in webpack.compat
config now also accept single configuration as a String to make them usable via arguments [#327]'The app is running at...'
successful compilation message when using HTTPS.Now using Webpack Dev Server (instead of running a basic Express development server).
Webpack Dev Server has security features which you may need to configure your way around if you're using --host
or if your development setup involves hitting the dev server from a different host.
Please create an issue if you're affected by this change and there's something nwb can do to mitigate dev server problems without compromising security.
React components/libraries
--[keep-]proptypes
flag replaces --no[-wrap]-proptypes
to disable wrapping of propTypes
in React component project builds so they'll be stripped from a production build.babel.stage = false
config.hmre = false
Express middleware option for disabling use of React Transform to attempt to handle Hot Module Reloading for React components and render()
error display [#263]Preact
preact-compat
configuration issues from v0.16.0.Arguments
--no-clear[-console]
flag to disable clearing of the console when running the dev server.--no-html
flag to disable creation of an index.html
file if you don't need one (e.g. you're serving your built apps via another means) [#278] [bwendt-mylo]Commands
nwb web (run|build)
command for quick development with vanilla JavaScript (i.e. you're in charge of rendering).Configuration
devServer
config to configure Webpack Dev Server options, which include:
devServer.historyApiFallback.disableDotRule
can be enabled if you need to use dots in your path when using the HTML5 History APIdevServer.https
can be used to enable HTTPSdevServer.proxy
can be used to proxy certain URLs to a separate API backend development servertype
option to nwb's Express middleware to set the project type (one of react
, preact
, inferno
or web
) manually, enabling use of the middleware without a config file.React
babel.removePropTypes
config to disable or configure removal of propTypes
in React app production builds.babel.reactConstantElements
config to disable the use of the React constant element hoisting transform in React app production builds.npm modules
react-component
and web-module
projects now uses babel-preset-stage-1
, so you can use export extensions by default if you need to re-export a library's modules in src/index.js
[#284]react-component
and web-module
projects now only uses Node 6 by default for quicker builds.Preact
preact/devtools
is now imported in development mode to enable use of React Developer Tools when using nwb preact run
. This has also been added to the preact-app
template.
For existing Preact apps, add the following to its entry point to enable this:
if (process.env.NODE_ENV === 'development') {
require('preact/devtools')
}
React components/libraries
prop-types
imports are now also removed from React component UMD production builds.--copy-files
flag properly [#317]publicPath
option changesDependencies: