-
Notifications
You must be signed in to change notification settings - Fork 231
Support a single webpack entry #230
Comments
Looking at the webpack docs (concepts; config) and config schema, it looks like the accepted forms of A) Single entry shorthand with single filename: module.exports = {
entry: './foo.js',
}; B) Single entry shorthand with an array of filenames: module.exports = {
entry: [
'./foo.js',
'./bar.js',
],
}; C) Object form with single filename: module.exports = {
entry: {
main: './foo.js',
},
}; D) Object form with an array of filenames: module.exports = {
entry: {
main: [
'./foo.js',
'./bar.js',
],
},
}; E) Dynamic entry(function): module.exports = {
entry: () => {
// Function must return one of the forms above (entry object, string, or array)
// or a promise to these things.
},
}; Returning back to webpack-chain, currently to set the entry point(s) one must use either: config.entry('main')
.add('./foo.js'); or: const Config = require('webpack-chain');
const config = new Config();
config.merge({
entry: {
main: ['./foo.js']
},
}); There seem to be as few problems with this:
@joeldenning was your main concern around (4)? |
No - my main concern is about (1). As far as I can tell, the following webpack config is not currently possible to construct with webpack chain: module.exports = {
entry: 'src/index.js'
} I agree supporting all possible entry types would be ideal. My PR in #239 doesn't address any missing entry types except for (1) |
Ah sorry I used numbers for both the "accepted webpack config output" forms and the "there are a few problems with this" list. I've changed the former to use A-E instead of numbers. By "was your main concern around (4)" I meant more was the issue relating to inputting to webpack-chain or the output format from webpack-chain, or something else? |
Ah I see now. Yes, my main concern is that webpack-chain's I'm looking to create the webpack config as shown in A) |
Sorry I haven't replied yet - need to sit down and think about this some more when I have more solid block of time free :-) |
👍 looking forward to hearing your thoughts on it |
Hello, I have kind of this issue, but I would like to use an object instead of an array for my entries. My goal is to have something like:
My main try is
But of course this does not work. To me the datastructure of an The |
Hi, I'd like to set I'm trying with following
But there is following error |
For the record, this issue is most likely not complete but the project is now abandoned #358. To all the maintainers, thank you for your contributions ! |
@homersimpsons Hi! Yeah sadly the GitHub mass-issue closing UI doesn't allow for choosing the closure-type of "Not planned" or leaving a comment (mentioning #358) - which meant I had to mass close as "Completed". |
It is possible to have the webpack
entry
be a string instead of an object. However, webpack-chain doesn't seem to support this, as shown in the following code:webpack-chain/src/Config.js
Lines 131 to 135 in 573553e
It's also possible to support an object where the values are strings, instead of arrays of strings.
Is this something you'd be open to changing? Am happy to discuss API and submit a PR for it.
The text was updated successfully, but these errors were encountered: