-
Notifications
You must be signed in to change notification settings - Fork 131
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
Switch over to Webpack from Browserify #6
Conversation
- Replaced Browserify dependencies with Webpack - Removed no longer necessary file extensions - Refactored npm scripts to call webpack (interface remains the same!)
- Implemented karma test runner with mocha unit tests and code coverage - Removed non-"essential" libraries such as es5-shim and console-polyfill (can be added back easily) - Updated package.json with revised run scripts (no major changes) - Updated test files to no longer include extension - Updated README with latest info
The coverage has decreased slightly due to the switch in tooling and different methods of determining code coverage. I believe the new, lower score is more accurate, so I guess that's a good thing :P |
You could perhaps use environment variables to differ between dev/production environments and use WebPack / Express servers respectively: var PORT = process.env['PORT'] || 3000;
if (process.env['NODE_ENV'] === 'development') {
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
var server = new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true
});
server.listen(PORT, 'localhost', function (err, result) {
if (err) console.log(err);
console.log('Listening at %s:%s', server.address.host, server.address.port);
});
} else {
var express = require('express');
...
} |
- Removed no longer needed 'xhr' dependency - Replaced expect.js with sinon and chai - Added unit test for request#getData() with mocking:
@declandewet interesting, also looks like the docs have some info to combine the two servers side-by-side. will take a look |
- Split webpack config into local and production - Removed no longer necessary run scripts - Extra documentation of webpack config
Switch over to Webpack from Browserify
Pretty straightforward idea, see #3 for more info.
TODO:
watch
andbuild
scripts worktest
script worksLet me know what you guys think, would like to get the community's opinion on best practices with Webpack while still maintaining the simplicity of the skeleton.