Skip to content
Plugin for creating device specific bundles with Razzle.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.gitignore
DeviceModuleReplacementPlugin.js
README.md
ServersPlugin.js
index.js
package.json
yarn.lock

README.md

razzle-plugin-device-specific-bundles

This package contains a plugin for creating device specific with Razzle.

See the example.

Usage in Razzle Projects

yarn add --dev razzle-plugin-device-specific-bundles

Using the plugin with the default options

// razzle.config.js

module.exports = {
  plugins: ['device-specific-bundles'],
};

With custom options:

// razzle.config.js

module.exports = {
  plugins: [
    {
      name: 'device-specific-bundles',
      options: {
        devices: ['desktop', 'mobile'],
        entry: 'ssr.js',
        alias: 'SSR'
      },
    },
  ],
};

Options

devices: array (defaults: ['desktop', 'mobile'])

An array with all the enabled devices

entry: string (defaults: ssr.js)

Entry point (relative to the src folder) of the server side rendering function file.

alias: string (defaults: SSR)

Alias used to include in the server (src/index.js) entry point the device specific server side rendering functions.

Considerations

Razzle comes with a react-dev-utils version that doesn't support webpack's multicompiler output, a newer version must be loaded using the selective version resolutions.

You can’t perform that action at this time.