Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

How to specify filename for entry #329

Closed
DanielStout5 opened this issue Mar 29, 2022 · 2 comments
Closed

How to specify filename for entry #329

DanielStout5 opened this issue Mar 29, 2022 · 2 comments

Comments

@DanielStout5
Copy link

DanielStout5 commented Mar 29, 2022

Webpack supports a lot more than just a single string for an entry:

https://webpack.js.org/configuration/entry-context/#entry-descriptor

module.exports = {
  //...
  entry: {
    home: './home.js',
    shared: ['react', 'react-dom', 'redux', 'react-redux'],
    catalog: {
      import: './catalog.js',
      filename: 'pages/catalog.js',
      dependOn: 'shared',
      chunkLoading: false, // Disable chunks that are loaded on demand and put everything in the main chunk.
    },
    personal: {
      import: './personal.js',
      filename: 'pages/personal.js',
      dependOn: 'shared',
      chunkLoading: 'jsonp',
      asyncChunks: true, // Create async chunks that are loaded on demand.
      layer: 'name of layer', // set the layer for an entry point
    },
  },
};

In my case I'd like to just be able to specify the filename. So e.g. I have:

config.entry('admin').add('./src/admin.js').end();

I need to specify a filename for the output from that entry - but from what I can tell, it seems like webpack-chain only supports a single string value for an entry. Is that the case, or have I missed something?

@DanielStout5
Copy link
Author

In the off chance anyone else is in the same situation - in my case I was trying to do this in the context of a Vue app. The vue-cli-service vue.config.js exposes chainWebpack and configureWebpack options, so I was able to use the function version of configureWebpack to overwrite config.entry with a function returning entries in the new webpack format.

@edmorley edmorley closed this as completed Feb 3, 2024
@edmorley
Copy link
Member

edmorley commented Feb 4, 2024

Closing since unfortunately this project is no longer maintained:
#358

@edmorley edmorley closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants