Skip to content

Support allowing an entry's name to be specified? #17

Description

@bbeck

Would you be open to a PR that allows users to specify the name (prefix) of an entry? I'm happy to do the work, just want to make sure it would be accepted if I did. It would look something like:

// config-overrides.js

const multipleEntry = require('react-app-rewire-multiple-entry')([
  {
    name: 'landing',   // <-- new property that would cause a filename of landing.[contenthash].chunk.js
    entry: 'src/entry/landing.js',
    template: 'public/landing.html',
    outPath: '/landing.html'
  }
]);

module.exports = {
  webpack: function(config, env) {
    multipleEntry.addMultiEntry(config);
    return config;
  }
};

In essence the change would be in the return statement of getValidSettings:

return {
  name: entry.name || formatName(entry.entry),   // <-- only call formatName if a name isn't specified
  entry: entryPath,
  template: entry.template,
  outPath: entry.outPath
};

This should be backwards compatible with all existing uses, but allow finer grained control over the naming of outputted files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions