Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/config/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ class Validator {
throw new Error('Missing public path: Call setPublicPath() to control the public path relative to where the files are written (the output path).');
}

if (this.webpackConfig.entries.size === 0 && this.webpackConfig.styleEntries.size === 0) {
throw new Error('No entries found! You must call addEntry() or addStyleEntry() at least once - otherwise... there is nothing to webpack!');
if (this.webpackConfig.entries.size === 0
&& this.webpackConfig.styleEntries.size === 0
&& this.webpackConfig.copyFilesConfigs.length === 0
) {
throw new Error('No entries found! You must call addEntry() or addStyleEntry() or copyFiles() at least once - otherwise... there is nothing to webpack!');
}
}

Expand Down
13 changes: 13 additions & 0 deletions test/config/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ describe('The validator function', () => {
}).to.throw('No entries found!');
});

it('should accept use with copyFiles() only', () => {
const config = createConfig();
config.setOutputPath('/tmp');
config.setPublicPath('/tmp');
config.copyFiles({ from: './' });

expect(() => {
validator(config);
}).not.throw();

expect(Object.keys(config.copyFilesConfigs).length).to.equal(1);
});

it('throws an error if there is no output path', () => {
const config = createConfig();
config.publicPath = '/';
Expand Down