Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bbeck opened this issue Aug 6, 2020 · 4 comments
Open

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

bbeck opened this issue Aug 6, 2020 · 4 comments

Comments

@bbeck
Copy link

bbeck commented Aug 6, 2020

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.

@kayali1411
Copy link

@Derek-Hu It is really helpful to have entry name support, do you have a plan to add it?

@tSchubes
Copy link

tSchubes commented Sep 9, 2020

+1

@Derek-Hu
Copy link
Owner

The output entry name is friendly for most users: #15

In case of entry name conflict unconsciously, customize entry name by user is allow.

@syug
Copy link

syug commented Oct 29, 2020

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants