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

Allow adding to current entry #46

Open
ylavoie opened this issue Apr 19, 2020 · 3 comments
Open

Allow adding to current entry #46

ylavoie opened this issue Apr 19, 2020 · 3 comments

Comments

@ylavoie
Copy link

ylavoie commented Apr 19, 2020

The plugin overwrite the current entry instead of adding to it.
What about if the user has other objects instead of only html files and want all?

@gwuhaolin
Copy link
Owner

                new WebPlugin({
			// file name or full path for output file, required.
			// pay attention not to duplication of name,as is will cover other file
			filename: 'index.html',
			// this html's requires entry,must be an array.dependent resource will inject into html use the order entry in array.
			requires: ['A', 'B'],
		})

@ylavoie
Copy link
Author

ylavoie commented Apr 19, 2020

Then what about the ones that aren't required by html? I have 128 html files to add as entries and a bunch of Dojo files, that I need preloaded.
To scan the html files, I need AutoWebPlugin, not WebPlugin, or I'll have to enumerate them manually.

@ylavoie
Copy link
Author

ylavoie commented Apr 19, 2020

I'd suggest modifying the AutoWebPlugin to allow an optional 3rd parameter, which would be the remainder of the desired entries, as such:

        constructor(pageDir, options, initialEntries) {
                options = Object.assign({}, options);
                this.options = options;
                this.entryMap = {};
                this.webpackEntry = initialEntries || {};

Then one can call it with the desired other entries:

    entry: autoWebPlugin.entry({
          'Configuration': 'Configuration/',
          'Contact_contact': 'Contact/contact.html',
          'Contact_pricelist': 'Contact/pricelist.html',
      },{
      'lsmb': 'lsmb/main',
      'login': 'lsmb/login',
      'lib': [
        'dojo/dom',
        'dojo/dom-style',
        'dojo/ready',
        'dojo/on',
      ]
    }),

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

2 participants