diff --git a/bin/build.js b/bin/build.js index b2774da..6bdd218 100755 --- a/bin/build.js +++ b/bin/build.js @@ -1,46 +1,3 @@ #!/usr/bin/env node -var webpack = require('webpack'); -var webpackConfig = require('./merge-configs'); -var fs = require('fs'); -var buildStats = false; - -console.log('\nBuilding webpack bundle...'); -webpack(webpackConfig, function(err, stats) { - if(err) { - console.log('Webpack build had fatal error:', err); - return; - } - - var options = { - hash: true, - version: true, - timings: true, - assets: true, - chunks: false, - colors: true - } - - console.log('Webpack compile was successful.'); - - var jsonStats = stats.toJson(); - if(jsonStats.errors.length > 0) { - console.log('Webpack had errors.'); - options.errors = true; - } - if(jsonStats.warnings.length > 0) { - console.log('Webpack had warnings.'); - options.warnings = true; - } - - console.log(stats.toString(options)); - - if(buildStats) { - fs.writeFile('./webpack-stats.json', JSON.stringify(stats.toJson()), function(err) { - if(err) { - return console.log(err); - } - - console.log('Webpack output stats were saved to', outputStatsPath); - }); - } -}); +require('./transpile'); // babel registration (runtime transpilation for node) +require('./build_es6.js'); diff --git a/bin/build_es6.js b/bin/build_es6.js new file mode 100644 index 0000000..70e24be --- /dev/null +++ b/bin/build_es6.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +const webpack = require('webpack'); +const webpackConfig = require('./merge-configs'); +const fs = require('fs'); +const buildStats = false; +const outputStatsPath = './webpack-stats.json'; + +console.log('\nBuilding webpack bundle...'); +webpack(webpackConfig, (err, stats) => { + if (err) { + console.log('Webpack build had fatal error:', err); + return; + } + + const options = { + hash: true, + version: true, + timings: true, + assets: true, + chunks: false, + colors: true + }; + + console.log('Webpack compile was successful.'); + + const jsonStats = stats.toJson(); + if (jsonStats.errors.length > 0) { + console.log('Webpack had errors.'); + options.errors = true; + } + if (jsonStats.warnings.length > 0) { + console.log('Webpack had warnings.'); + options.warnings = true; + } + + console.log(stats.toString(options)); + + if (buildStats) { + fs.writeFile(outputStatsPath, JSON.stringify(stats.toJson()), (writeError) => { + if (writeError) { + return console.log(writeError); + } + + console.log('Webpack output stats were saved to', outputStatsPath); + }); + } +}); diff --git a/bin/local-dev.sh b/bin/local-dev.sh index 164f7b2..e360512 100755 --- a/bin/local-dev.sh +++ b/bin/local-dev.sh @@ -25,8 +25,8 @@ compile() { echo Source: $ROOT_DIR echo Destination: $PROJECT_PATH/node_modules/universal-redux echo - cp $ROOT_DIR/bin/* $PROJECT_PATH/node_modules/universal-redux/bin/ > /dev/null - cp $ROOT_DIR/config/* $PROJECT_PATH/node_modules/universal-redux/config/ > /dev/null + cp -a $ROOT_DIR/bin/* $PROJECT_PATH/node_modules/universal-redux/bin/ > /dev/null + cp -a $ROOT_DIR/config/* $PROJECT_PATH/node_modules/universal-redux/config/ > /dev/null cp $ROOT_DIR/.babelrc $PROJECT_PATH/node_modules/universal-redux cp $ROOT_DIR/.eslintrc $PROJECT_PATH/node_modules/universal-redux babel $ROOT_DIR/src/ --presets es2015,stage-0,react --plugins transform-runtime --out-dir $PROJECT_PATH/node_modules/universal-redux/lib > /dev/null diff --git a/bin/merge-babel-config.js b/bin/merge-babel-config.js index 365752a..53e25ce 100644 --- a/bin/merge-babel-config.js +++ b/bin/merge-babel-config.js @@ -1,65 +1,43 @@ -var fs = require('fs'); -var strip = require('strip-loader'); -var path = require('path'); -var util = require('util'); - -module.exports = function(userBabelConfig, verbose) { - - var babelrc = fs.readFileSync(path.resolve(__dirname, '..', './.babelrc')); - var babelConfig = {}; - var jsLoaders; - - try { - babelConfig = JSON.parse(babelrc); - } catch (err) { - console.error('==> ERROR: Error parsing your .babelrc.'); - console.error(err); - } - - if(userBabelConfig) { - console.log('Merging universal-redux Babel defaults with project Babel configuration'); - - var userBabelConfigFile = fs.readFileSync(path.resolve(userBabelConfig)); - var userBabelConfig = {}; - - try { - userBabelConfig = JSON.parse(userBabelConfigFile); - } catch (err) { - console.error('==> ERROR: Error parsing your project-level Babel configuration.'); - console.error(err); - } - - babelConfig = Object.assign(babelConfig, userBabelConfig); - } - - if (process.env.NODE_ENV !== 'production') { +const fs = require('fs'); +const strip = require('strip-loader'); +const path = require('path'); +const util = require('util'); +const isProduction = process.env.NODE_ENV !== 'production'; + +function loadAndParse(filePath) { + const file = fs.readFileSync(filePath); + return JSON.parse(file); +} - var hmrConfig = [ - "react-transform", { - "transforms": [ - { - "transform": "react-transform-hmr", - "imports": ["react"], - "locals": ["module"] - }, - { - "transform": "react-transform-catch-errors", - "imports": ["react", "redbox-react"] - } - ] +module.exports = (userBabelConfig, verbose) => { + + const baseBabelConfig = loadAndParse(path.resolve(__dirname, '..', './.babelrc')); + const babelConfig = userBabelConfig ? Object.assign(baseBabelConfig, loadAndParse(path.resolve(userBabelConfig))) : baseBabelConfig; + + const hmrConfig = [ + 'react-transform', { + 'transforms': [ + { + 'transform': 'react-transform-hmr', + 'imports': ['react'], + 'locals': ['module'] + }, + { + 'transform': 'react-transform-catch-errors', + 'imports': ['react', 'redbox-react'] } ] + } + ]; - babelConfig.env.development.plugins.unshift(hmrConfig); + babelConfig.env.development.plugins.unshift(hmrConfig); - jsLoaders = ['babel-loader?' + JSON.stringify(babelConfig)]; - } else { - jsLoaders = [strip.loader('debug'), 'babel-loader?' + JSON.stringify(babelConfig)]; - } + const babelLoader = 'babel-loader?' + JSON.stringify(babelConfig); + const jsLoaders = isProduction ? [strip.loader('debug'), babelLoader] : [babelLoader]; // output configuration files if user wants verbosity - if(verbose) { - var utilOptions = { + if (verbose) { + const utilOptions = { depth: 10, colors: true }; @@ -69,4 +47,4 @@ module.exports = function(userBabelConfig, verbose) { } return jsLoaders; -} +}; diff --git a/bin/merge-configs.js b/bin/merge-configs.js index ce9e1cb..0a65e1b 100644 --- a/bin/merge-configs.js +++ b/bin/merge-configs.js @@ -1,65 +1,62 @@ #!/usr/bin/env node -var _ = require('lodash'); -var path = require('path'); -var util = require('util'); -var webpack = require('webpack'); -var mergeWebpack = require('webpack-config-merger'); -var mergeBabel = require('./merge-babel-config'); -var baseWebpackConfig = require('../config/webpack.config.js'); -var baseDevConfig = mergeWebpack(baseWebpackConfig.common, baseWebpackConfig.development); -var baseProdConfig = mergeWebpack(baseWebpackConfig.common, baseWebpackConfig.production); -var baseToolsConfig = require('../config/webpack-isomorphic-tools-config'); -var WebpackErrorNotificationPlugin = require('webpack-error-notification'); - -var isProduction = process.env.NODE_ENV === 'production'; +const path = require('path'); +const util = require('util'); + +const lodash = require('lodash'); +const webpack = require('webpack'); +const mergeWebpack = require('webpack-config-merger'); +const mergeBabel = require('./merge-babel-config'); +const baseWebpackConfig = require('../config/webpack.config.js'); +const baseDevConfig = mergeWebpack(baseWebpackConfig.common, baseWebpackConfig.development); +const baseProdConfig = mergeWebpack(baseWebpackConfig.common, baseWebpackConfig.production); +const baseToolsConfig = require('../config/webpack-isomorphic-tools-config'); +const WebpackErrorNotificationPlugin = require('webpack-error-notification'); + +const isProduction = process.env.NODE_ENV === 'production'; // gather webpack config -var userConfigPath = 'config/universal-redux.config.js'; -var userConfig = require(path.resolve(userConfigPath)); +const userConfigPath = 'config/universal-redux.config.js'; +const userConfig = require(path.resolve(userConfigPath)); // merge with base config if directed to -if(userConfig.webpack.merge) { - var baseConfig = isProduction ? baseProdConfig : baseDevConfig; - combinedWebpackConfig = mergeWebpack(baseConfig, userConfig.webpack.config); -} else { - combinedWebpackConfig = userConfig.webpack.config; -} +const baseConfig = isProduction ? baseProdConfig : baseDevConfig; +const combinedWebpackConfig = userConfig.webpack.merge ? mergeWebpack(baseConfig, userConfig.webpack.config) : userConfig.webpack.config; // add babel for js transpiling -var babelConfig = mergeBabel(userConfig.babelConfig, userConfig.verbose); +const babelConfig = mergeBabel(userConfig.babelConfig, userConfig.verbose); combinedWebpackConfig.module.loaders.unshift({ test: /\.jsx?$/, exclude: /node_modules/, loaders: babelConfig }); // gather tools config -var combinedToolsConfig = baseToolsConfig; -if(userConfig.toolsConfigPath) { - var userToolsConfig = require(path.resolve(userConfig.toolsConfigPath)); - combinedToolsConfig = _.merge(baseToolsConfig, userToolsConfig); +const combinedToolsConfig = baseToolsConfig; +if (userConfig.toolsConfigPath) { + const userToolsConfig = require(path.resolve(userConfig.toolsConfigPath)); + combinedToolsConfig = lodash.merge(baseToolsConfig, userToolsConfig); } combinedToolsConfig.webpack_assets_file_path = 'node_modules/universal-redux/webpack-assets.json'; // add tools settings to combined weback config -var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin'); -var toolsPlugin = new WebpackIsomorphicToolsPlugin(combinedToolsConfig); +const WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin'); +const toolsPlugin = new WebpackIsomorphicToolsPlugin(combinedToolsConfig); combinedWebpackConfig.module.loaders.push({ test: toolsPlugin.regular_expression('images'), loader: 'url-loader?limit=10240' }); combinedWebpackConfig.plugins.push(isProduction ? toolsPlugin : toolsPlugin.development()); // turn on linting per webpack build, unless directed not to -if(userConfig.lint && userConfig.lint.enabled !== false && !isProduction) { +if (userConfig.lint && userConfig.lint.enabled !== false && !isProduction) { combinedWebpackConfig.module.loaders[0].loaders.push('eslint-loader'); const lintConfigPath = userConfig.lint.config || path.resolve(__dirname, '../.eslintrc'); combinedWebpackConfig.eslint = { configFile: lintConfigPath - } -} + }; +} // turn on desktop notifications if user elects to -if(userConfig.notifications === true && !isProduction) { +if (userConfig.notifications === true && !isProduction) { combinedWebpackConfig.plugins.push(new WebpackErrorNotificationPlugin()); } // add default settings that are used by server via process.env -var definitions = { +const definitions = { __LOGGER__: false, __DEVTOOLS__: !isProduction, __DEVELOPMENT__: !isProduction, @@ -67,7 +64,7 @@ var definitions = { }; // override with user settings -_.each(userConfig.globals, function(value, key) { definitions[key] = JSON.stringify(value); }); +lodash.each(userConfig.globals, (value, key) => { definitions[key] = JSON.stringify(value); }); combinedWebpackConfig.plugins.push(new webpack.DefinePlugin(definitions)); // add routes and reducer aliases so that client has access to them @@ -75,22 +72,22 @@ combinedWebpackConfig.resolve.alias = combinedWebpackConfig.resolve.alias || {}; combinedWebpackConfig.resolve.alias.routes = userConfig.routes; combinedWebpackConfig.resolve.alias.reducers = userConfig.redux.reducers; combinedWebpackConfig.resolve.alias.config = combinedWebpackConfig.context + '/' + userConfigPath; -if(userConfig.redux.middleware) { +if (userConfig.redux.middleware) { combinedWebpackConfig.resolve.alias.middleware = userConfig.redux.middleware; } else { - combinedWebpackConfig.resolve.alias.middleware = path.resolve(__dirname, '../lib/redux/middleware/index.js'); + combinedWebpackConfig.resolve.alias.middleware = path.resolve(__dirname, '../src/redux/middleware/index.js'); } // add project level vendor libs -if(userConfig.webpack && userConfig.webpack.vendorLibraries && isProduction) { - _.each(userConfig.webpack.vendorLibraries, (lib) => { +if (userConfig.webpack && userConfig.webpack.vendorLibraries && isProduction) { + lodash.each(userConfig.webpack.vendorLibraries, (lib) => { combinedWebpackConfig.entry.vendor.push(lib); }); } // output configuration files if user wants verbosity -if(userConfig.verbose) { - var utilOptions = { +if (userConfig.verbose) { + const utilOptions = { depth: 6, colors: true }; diff --git a/bin/transpile.js b/bin/transpile.js index 1f409f4..a1a4b3d 100644 --- a/bin/transpile.js +++ b/bin/transpile.js @@ -1,5 +1,6 @@ // enable runtime transpilation to use ES6/7 in node +/* eslint-disable */ var fs = require('fs'); var path = require('path'); @@ -12,5 +13,6 @@ try { console.error('==> ERROR: Error parsing your babelrc'); console.error(err); } +/* eslint-enable */ require('babel-core/register')(config); diff --git a/bin/webpack-dev-server.js b/bin/webpack-dev-server.js index 2ec1037..533dbe0 100755 --- a/bin/webpack-dev-server.js +++ b/bin/webpack-dev-server.js @@ -1,35 +1,3 @@ #!/usr/bin/env node -var path = require('path'); -var Express = require('express'); -var webpack = require('webpack'); -var webpackConfig = require('./merge-configs'); -var userConfig = require(path.resolve('config/universal-redux.config.js')); - -var compiler = webpack(webpackConfig); - -var host = userConfig.server.host || 'localhost'; -var port = parseInt(userConfig.server.port) + 1 || 3001; -var serverOptions = { - contentBase: 'http://' + host + ':' + port, - quiet: true, - noInfo: true, - hot: true, - inline: true, - lazy: false, - publicPath: webpackConfig.output.publicPath, - headers: {'Access-Control-Allow-Origin': '*'}, - stats: {colors: true} -}; - -var app = new Express(); - -app.use(require('webpack-dev-middleware')(compiler, serverOptions)); -app.use(require('webpack-hot-middleware')(compiler)); - -app.listen(port, function onAppListening(err) { - if (err) { - console.error(err); - } else { - console.info('==> 🚧 Webpack development server listening on port %s', port); - } -}); +require('./transpile'); // babel registration (runtime transpilation for node) +require('./webpack-dev-server_es6.js'); diff --git a/bin/webpack-dev-server_es6.js b/bin/webpack-dev-server_es6.js new file mode 100644 index 0000000..cc79c44 --- /dev/null +++ b/bin/webpack-dev-server_es6.js @@ -0,0 +1,35 @@ +#!/usr/bin/env node +const path = require('path'); +const Express = require('express'); +const webpack = require('webpack'); +const webpackConfig = require('./merge-configs'); +const userConfig = require(path.resolve('config/universal-redux.config.js')); + +const compiler = webpack(webpackConfig); + +const host = userConfig.server.host || 'localhost'; +const port = parseInt(userConfig.server.port, 10) + 1 || 3001; +const serverOptions = { + contentBase: 'http://' + host + ':' + port, + quiet: true, + noInfo: true, + hot: true, + inline: true, + lazy: false, + publicPath: webpackConfig.output.publicPath, + headers: {'Access-Control-Allow-Origin': '*'}, + stats: {colors: true} +}; + +const app = new Express(); + +app.use(require('webpack-dev-middleware')(compiler, serverOptions)); +app.use(require('webpack-hot-middleware')(compiler)); + +app.listen(port, function onAppListening(err) { + if (err) { + console.error(err); + } else { + console.info('==> 🚧 Webpack development server listening on port %s', port); + } +}); diff --git a/config/universal-redux.config.js b/config/universal-redux.config.js index 24ea985..b12cf32 100644 --- a/config/universal-redux.config.js +++ b/config/universal-redux.config.js @@ -1,4 +1,3 @@ -/* eslint-disable */ const path = require('path'); const isProduction = process.env.NODE_ENV === 'production'; const projectRoot = path.resolve(__dirname, '..'); @@ -76,12 +75,17 @@ module.exports = { // on production. // // Expects: Boolean - */ + */ lint: { enabled: true // config: projectRoot + '/.eslintrc' }, + /* + // Project level babelConfig to be merged with defaults. Optional. + // + // Expects: String + */ babelConfig: projectRoot + '/.babelrc', /* @@ -89,7 +93,7 @@ module.exports = { // Will not be run on production. // // Expects: Boolean - */ + */ notifications: false, /* @@ -97,7 +101,7 @@ module.exports = { // webpack-isomorphic-tools configuration. Optional. // // Expects: String - */ + */ // toolsConfigPath: __dirname + '/webpack-isomorphic-tools.config.js', /* @@ -105,7 +109,7 @@ module.exports = { // Tools configurations at startup // // Expects: Boolean - */ + */ verbose: true, /* @@ -135,6 +139,8 @@ module.exports = { // The path to your replacement for the default HTML shell. Optional. // If not provided, the default used will be that in // src/containers/HtmlShell/HtmlShell.js. Will be added to Webpack aliases. + // + // Expects: String */ htmlShell: sourceRoot + '/containers/HtmlShell/HtmlShell.js', @@ -149,9 +155,9 @@ module.exports = { // be merged. // // If the `merge` parameter is `false`, default webpack settings - // will not be used and the config specified here will need to + // will not be used and the config specified here will need to // be the complete settings required for building. - */ + */ merge: true, /* @@ -164,9 +170,9 @@ module.exports = { /* // Webpack configuration cusomtizations. There are more parameters - // available than specified here. For the full list, see + // available than specified here. For the full list, see // https://webpack.github.io/docs/configuration.html. - */ + */ config: { /* @@ -195,12 +201,11 @@ module.exports = { resolve: { /* - // Not recommended to change. + // Ensure this maps to the source root of your project, not that of + // Universal Redux */ root: sourceRoot } } } - }; -/* eslint-enable */ diff --git a/config/webpack-isomorphic-tools-config.js b/config/webpack-isomorphic-tools-config.js index dda72b6..cad7b9f 100644 --- a/config/webpack-isomorphic-tools-config.js +++ b/config/webpack-isomorphic-tools-config.js @@ -1,16 +1,16 @@ -var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin'); +const WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin'); // see this link for more info on what all of this means // https://github.com/halt-hammerzeit/webpack-isomorphic-tools module.exports = { - // when adding "js" extension to asset types + // when adding "js" extension to asset types // and then enabling debug mode, it may cause a weird error: // // [0] npm run start-prod exited with code 1 // Sending SIGTERM to other processes.. // - // debug: true, + // debug: true, assets: { images: { @@ -36,37 +36,37 @@ module.exports = { parser: WebpackIsomorphicToolsPlugin.url_loader_parser }, style_modules: { - extensions: ['css', 'less','scss'], - filter: function(module, regex, options, log) { + extensions: ['css', 'less', 'scss'], + filter: (module, regex, options, log) => { if (options.development) { // in development mode there's webpack "style-loader", // so the module.name is not equal to module.name return WebpackIsomorphicToolsPlugin.style_loader_filter(module, regex, options, log); - } else { - // in production mode there's no webpack "style-loader", - // so the module.name will be equal to the asset path - return regex.test(module.name); } + + // in production mode there's no webpack "style-loader", + // so the module.name will be equal to the asset path + return regex.test(module.name); }, - path: function(module, options, log) { + path: (module, options, log) => { if (options.development) { // in development mode there's webpack "style-loader", // so the module.name is not equal to module.name return WebpackIsomorphicToolsPlugin.style_loader_path_extractor(module, options, log); - } else { - // in production mode there's no webpack "style-loader", - // so the module.name will be equal to the asset path - return module.name; } + + // in production mode there's no webpack "style-loader", + // so the module.name will be equal to the asset path + return module.name; }, - parser: function(module, options, log) { + parser: (module, options, log) => { if (options.development) { return WebpackIsomorphicToolsPlugin.css_modules_loader_parser(module, options, log); - } else { - // in production mode there's Extract Text Loader which extracts CSS text away - return module.source; } + + // in production mode there's Extract Text Loader which extracts CSS text away + return module.source; } } } -} +}; diff --git a/config/webpack.config.js b/config/webpack.config.js index b62b329..534dc02 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -1,27 +1,26 @@ // require('babel/polyfill'); // begin shared setup -var path = require('path'); -var webpack = require('webpack'); -var relativeAssetsPath = '../static/dist'; -var assetsPath = path.join(__dirname, relativeAssetsPath); +const path = require('path'); +const webpack = require('webpack'); +const relativeAssetsPath = '../static/dist'; +const assetsPath = path.join(__dirname, relativeAssetsPath); // begin dev setup -var host = (process.env.HOST || 'localhost'); -var port = parseInt(process.env.PORT) + 1 || 3001; +const host = (process.env.HOST || 'localhost'); +const port = parseInt(process.env.PORT, 10) + 1 || 3001; // begin prod setup -var CleanPlugin = require('clean-webpack-plugin'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); +const CleanPlugin = require('clean-webpack-plugin'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); -var vendor = [ +const vendor = [ 'lodash', 'react', 'react-dom', 'react-router', 'react-redux', 'redux', - 'redux-form', 'redux-logger', 'redux-simple-router' ]; @@ -41,11 +40,11 @@ module.exports = { loaders: [ // { test: /\.jsx?$/, exclude: /node_modules/, loaders: jsLoaders }, // now prepended in merge-configs and merge-babel-config { test: /\.json$/, loader: 'json-loader' }, - { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" }, - { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" }, - { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" }, - { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" }, - { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" } + { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff' }, + { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff' }, + { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream' }, + { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file' }, + { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml' } ] }, progress: true, @@ -53,6 +52,7 @@ module.exports = { modulesDirectories: [ 'src', 'node_modules', + 'node_modules/universal-redux/src', 'node_modules/universal-redux/node_modules' ], extensions: ['', '.json', '.js', '.jsx'] @@ -61,6 +61,7 @@ module.exports = { modulesDirectories: [ 'src', 'node_modules', + 'node_modules/universal-redux/src', 'node_modules/universal-redux/node_modules' ] } @@ -79,7 +80,7 @@ module.exports = { }, module: { loaders: [ - { test: /\.css$/, loader: "style!css" }, + { test: /\.css$/, loader: 'style!css' }, { test: /\.less$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap' }, { test: /\.scss$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap' } ] @@ -121,7 +122,7 @@ module.exports = { __SERVER__: false }), - // set global vars + // set global consts new webpack.DefinePlugin({ 'process.env': { // Useful to reduce the size of client-side libraries, e.g. react @@ -143,4 +144,4 @@ module.exports = { }) ] } -} +}; diff --git a/package.json b/package.json index 75fbefc..8c8a187 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ "scripts": { "compile": "babel --presets es2015,stage-0,react --plugins transform-runtime src/ --out-dir lib/", "dev": "./bin/local-dev.sh", - "prepublish": "npm run compile", - "lint": "eslint -c .eslintrc src", - "test": "karma start" + "lint": "eslint -c .eslintrc src bin config", + "test": "karma start", + "prepublish": "npm run compile" }, "dependencies": { "autoprefixer-loader": "^3.1.0", diff --git a/src/client.js b/src/client.js index 5ff1092..2494ff8 100755 --- a/src/client.js +++ b/src/client.js @@ -18,7 +18,7 @@ import getRoutes from 'routes'; import reducers from 'reducers'; import customMiddleware from 'middleware'; -// assemble custom middleware, pass req, res +// assemble custom middleware const middleware = []; each(customMiddleware, (customMiddlewareToAdd) => { if (typeof customMiddlewareToAdd === 'function') {