Skip to content
This repository has been archived by the owner on Nov 15, 2017. It is now read-only.

Commit

Permalink
Merged in changes from origin
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Jul 19, 2016
2 parents 436d9a9 + dcab988 commit 17844fd
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 5 deletions.
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.3.3",
"description": "React Universally with PostCSS",
"main": "build/server/main.js",
"engines": {
"node": "~6.3.0"
},
"scripts": {
"dev": "npm run dev:start",
"dev:start": "node ./devServer",
Expand Down Expand Up @@ -111,5 +114,35 @@
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.12.1",
"webpack-node-externals": "^1.2.0"
"devDependencies": {
"assets-webpack-plugin": "3.4.0",
"babel-cli": "6.10.1",
"babel-core": "6.10.4",
"babel-eslint": "6.1.2",
"babel-loader": "6.2.4",
"babel-preset-es2015-webpack": "6.4.1",
"babel-preset-react": "6.11.1",
"chokidar": "1.6.0",
"css-loader": "0.23.1",
"dotenv": "2.0.0",
"eslint": "2.13.1",
"eslint-config-airbnb": "9.0.1",
"eslint-loader": "1.4.1",
"eslint-plugin-import": "1.10.3",
"eslint-plugin-jsx-a11y": "1.5.5",
"eslint-plugin-react": "5.2.2",
"extract-text-webpack-plugin": "2.0.0-beta.2",
"fake-style-loader": "1.0.1",
"json-loader": "0.5.4",
"node-notifier": "4.6.0",
"normalize.css": "4.2.0",
"path": "0.12.7",
"react-hot-loader": "3.0.0-beta.2",
"rimraf": "2.5.3",
"style-loader": "0.13.1",
"webpack": "2.1.0-beta.19",
"webpack-dev-middleware": "1.6.1",
"webpack-hot-middleware": "2.12.1",
"webpack-node-externals": "1.2.0"
}
}
4 changes: 2 additions & 2 deletions webpack.client.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const webpackConfigFactory = require("./webpackConfigFactory")

module.exports = function clientConfigFactory(options = {}) {
module.exports = function clientConfigFactory(options = {}, args = {}) {
const { mode = "development" } = options
return webpackConfigFactory({ target: "client", mode, root: __dirname })
return webpackConfigFactory({ target: "client", mode, root: __dirname }, args)
}
4 changes: 2 additions & 2 deletions webpack.server.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const webpackConfigFactory = require("./webpackConfigFactory")

module.exports = function serverConfigFactory(options = {}) {
module.exports = function serverConfigFactory(options = {}, args = {}) {
const { mode = "development" } = options
return webpackConfigFactory({ target: "server", mode, root: __dirname })
return webpackConfigFactory({ target: "server", mode, root: __dirname }, args)
}
38 changes: 37 additions & 1 deletion webpackConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function merge()
)
}

function webpackConfigFactory({ target, mode, root })
function webpackConfigFactory({ target, mode, root }, { json })
{
if (!target || !~[ "client", "server" ].findIndex((valid) => target === valid))
{
Expand All @@ -77,6 +77,23 @@ function webpackConfigFactory({ target, mode, root })
}

// console.log(`Creating webpack "${target}" config in "${mode}" mode...`)
if (!json) {
// Our bundle is outputing json for bundle analysis, therefore we don't
// want to do this console output as it will interfere with the json output.
//
// You can run a bundle analysis by executing the following:
//
// $(npm bin)/webpack \
// --env.mode production \
// --config webpack.client.config.js \
// --json \
// > build/client/analysis.json
//
// And then upload the build/client/analysis.json to http://webpack.github.io/analyse/
// This allows you to analyse your webpack bundle to make sure it is
// optimal.
console.log(`Creating webpack "${target}" config in "${mode}" mode`);
}

const isDev = mode === "development"
const isProd = mode === "production"
Expand Down Expand Up @@ -193,7 +210,15 @@ function webpackConfigFactory({ target, mode, root })
mainFields: [ "jsnext:main", "main" ],

// These extensions are tried when resolving a file.
<<<<<<< HEAD
extensions: [ ".js", ".jsx", ".json" ],
=======
extensions: [
'.js',
'.jsx',
'.json',
],
>>>>>>> dcab988
},
plugins: removeEmpty([
Expand Down Expand Up @@ -275,10 +300,16 @@ function webpackConfigFactory({ target, mode, root })
// This is a production client so we will extract our CSS into
// CSS files.
ifProdClient(
<<<<<<< HEAD
new ExtractTextPlugin({
filename: "[name]-[chunkhash].css",
allChunks: true
})
=======
// This is a production client so we will extract our CSS into
// CSS files.
new ExtractTextPlugin({ filename: '[name]-[chunkhash].css', allChunks: true })
>>>>>>> dcab988
),
]),
Expand Down Expand Up @@ -386,8 +417,13 @@ function webpackConfigFactory({ target, mode, root })
// Javascript
{
test: /\.jsx?$/,
<<<<<<< HEAD
loader: "babel-loader",
exclude: [ /node_modules/, path.resolve(root, "./build") ],
=======
loader: 'babel-loader',
exclude: [/node_modules/, path.resolve(__dirname, './build')],
>>>>>>> dcab988
query: merge(
{
env:
Expand Down

0 comments on commit 17844fd

Please sign in to comment.