Skip to content

v0.11.0

Compare
Choose a tag to compare
@insin insin released this 07 Jun 16:58
· 809 commits to master since this release

Breaking Changes:

  • Replaced the deprecated autoprefixer-loader with postcss-loader in default style pipelines - it's configured to do the same autoprefixing by default [#57]
    • If you were configuring vendor prefixing using webpack.loaders.autoprefixer, you will now need to manage an autprefixer dependency yourself and use webpack.postcss to perform this configuration.

nwb.config.js Config Format Changes:

For deprecations, nwb v0.11 will support the old format and display warning messages about the changes required.

  • webpack.plugins is deprecated - config under webpack.plugins should be moved up into webpack instead. Having certain config under a plugins prop was an implementation detail which wasn't relevant to end-users [#113]

    // < v0.11
    module.exports = {
      webpack: {
        plugins: {
          define: {...},
          html: {...}
        }
      }
    }
    // v0.11
    module.exports = {
      webpack: {
        define: {...},
        html: {...}
      }
    }
  • Support for flatter Webpack loader configuration was added. Having a query object is now optional - loader query configuration can now be placed directly under the loader's id [#113]

    // < v0.11
    module.exports = {
      webpack: {
        loaders: {
          css: {
            query: {
              modules: true
            }
          }
        }
      }
    }
    // v0.11
    module.exports = {
      webpack: {
        loaders: {
          css: {
            modules: true
          }
        }
      }
    }

Added:

  • Installing globally now adds a react command for quick React development starting from a single file.
    • react run entry.js runs a development server.
    • react build entry.js creates a static build.
    • For these commands, Babel is preconfigured to allow you to use all of its Stage 0 features out of the box, including async/await.
    • These are implemented by (the previously undocumented) serve-react and (new) build-react nwb commands.
  • The entry point for apps and npm module UMD builds can now be specified as an argument to build and serve commands. The default is still src/index.js. [#115]
  • The directory web apps are built into can now be specified as an argument to build, clean and serve commands. The default is still dist/.
  • Added webpack.compat config to enable compatibility tweaks for modules which are known to be problematic with Webpack - initially this includes support for Enzyme, Moment.js and Sinon.js 1.x [#108]
  • Added webpack.postcss config to customise the PostCSS plugins applied to each style pipeline [#57]
  • Added webpack.vendorBundle config to disable automatically extracting anything imported from node_modules/ out into a separate vendor chunk [#106]
  • Added documentation for creating and using a test context module if there's code you need to run prior to tests running, such as configuring your assertion library with additional assertions.
  • Added a --config option to allow you to specify your own config file instead of nwb.config.js.

Changed:

  • Apps are no longer required to provide their own HTML template. The default template path of src/index.html will continue to be used if a file exists there. If an alternative template is not provided via webpack.html config, nwb will now fall back to using a basic template.
  • Restored default use of the Babel polyfill in Karma config so tests (and their dependencies) can assume a modern environment.
  • Default babel-loader config now uses cacheDirectory: true for a speedup.
  • Improved debug output (activated with a DEBUG=nwb environment variable) to print config objects in full - if you're configuring plugin objects (e.g. PostCSS plugins), it's recommended to create instances of them if you want to use debug output.
  • webpack.optimize.DedupePlugin is now only used for production builds, as recommended in the Webpack docs.

Dependencies: