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

Add default filename when using through api #103

Merged
merged 1 commit into from Mar 9, 2015

Conversation

hswolff
Copy link
Contributor

@hswolff hswolff commented Feb 5, 2015

When trying to set-up webpack-dev-server today via the API I ran into an issue that I was unable to ever load the bundle.

The issue was that the filename is only given a default when set via the CLI. I updated the wiki to note this requirement however it'd be good to have it built into the code by default.

@sokra
Copy link
Member

sokra commented Mar 4, 2015

This should be added to the documentation, but I think adding a default to the API is the wrong way. There should be a error message instead when in lazy mode but no filename provided. The default would be wrong in 99% of cases and propably lead to confusion.

@hswolff
Copy link
Contributor Author

hswolff commented Mar 4, 2015

Would you want to throw an error or just log it?

@sokra
Copy link
Member

sokra commented Mar 4, 2015

Throw it.

@hswolff
Copy link
Contributor Author

hswolff commented Mar 4, 2015

Rebased + updated.

@@ -14,6 +14,9 @@ var historyApiFallback = require("connect-history-api-fallback");
function Server(compiler, options) {
// Default options
if(!options) options = {};

if (!options.filename) throw new Error("'filename' option must be set.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only required in lazy mode. So check of options.lazy.

@hswolff
Copy link
Contributor Author

hswolff commented Mar 7, 2015

Updated!

sokra added a commit that referenced this pull request Mar 9, 2015
Add default filename when using through api
@sokra sokra merged commit a5a9e2e into webpack:master Mar 9, 2015
@sokra
Copy link
Member

sokra commented Mar 9, 2015

Thanks

@hswolff hswolff deleted the api-default branch March 10, 2015 00:07
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

Successfully merging this pull request may close these issues.

None yet

2 participants