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

__writeApplicationStarter() crashes when no server config exists #18

Closed
mindjuice opened this issue Jun 12, 2014 · 2 comments
Closed

__writeApplicationStarter() crashes when no server config exists #18

mindjuice opened this issue Jun 12, 2014 · 2 comments

Comments

@mindjuice
Copy link

The following line crashes when your mimosa-config file has no server entries:

serverRelPath = config.server.path.split(config.root)[1].substr(1);

See https://github.com/dbashford/mimosa-web-package/blob/master/src/index.coffee#L174

A workaround is to set the following in your mimosa-config.coffee (or the equivalent in your mimosa-config.js):

webPackage:
  appjs: undefined

If you run into this problem, it's probably because you don't actually have a server to run, so adding the above to your config is something you should do anyway, but Mimosa shouldn't crash if you setup your config incorrectly.

I would just patch this and submit a PR, but I'm not sure what the value of serverRelPath should be if server is not defined. Just "." maybe?

@dbashford
Copy link
Owner

I think the larger issue is... if you don't have a server, you don't need app.js. Probably a safe assumption, ya?

So in config.coffee, the validate method could check to see if there is a server config, and if not, set config.webPackage.appjs to null.

@mindjuice
Copy link
Author

Agreed. That should work. I can add a line to the validate method and submit a PR.

mindjuice pushed a commit to mindjuice/mimosa-web-package that referenced this issue Jun 17, 2014
When mimosa-config.coffee (or .js) contains the web-package module, but
no server config section (or a server config section with no path:
entry), then the crash would occur.

Added code to config.coffee to set the config.webPackage.appjs to
undefined in this case so that the code generation step is bypassed.

Also handles the case where you have a server: section in your
mimosa-config.coffee file, but no path: entry.
dbashford added a commit that referenced this issue Jun 19, 2014
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