From 7a7f8f7c5388e23d78e56a1b3bc364c00fbaa0b0 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Wed, 3 Jan 2018 16:58:34 -0800 Subject: [PATCH] Moved config files to a separate folder --- setupJest.js => config/setupJest.js | 0 webpack.config.js => config/webpack.base.js | 8 ++++---- webpack.config.dev.js => config/webpack.dev.js | 2 +- webpack.config.prod.js => config/webpack.prod.js | 8 +++----- package.json | 8 ++++---- server/index.js | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) rename setupJest.js => config/setupJest.js (100%) rename webpack.config.js => config/webpack.base.js (92%) rename webpack.config.dev.js => config/webpack.dev.js (92%) rename webpack.config.prod.js => config/webpack.prod.js (88%) diff --git a/setupJest.js b/config/setupJest.js similarity index 100% rename from setupJest.js rename to config/setupJest.js diff --git a/webpack.config.js b/config/webpack.base.js similarity index 92% rename from webpack.config.js rename to config/webpack.base.js index 390bfc5e..44962f5b 100644 --- a/webpack.config.js +++ b/config/webpack.base.js @@ -32,8 +32,8 @@ module.exports = { test: /\.js$/, loader: 'babel-loader', include: [ - path.join(__dirname, 'app'), - path.join(__dirname, 'shared'), + path.join(__dirname, '../app'), + path.join(__dirname, '../shared'), ], }, { test: /\.json$/, loader: 'json-loader' }, @@ -57,11 +57,11 @@ module.exports = { }, resolve: { modules: [ - path.resolve(__dirname, 'app'), + path.resolve(__dirname, '../app'), 'node_modules' ], alias: { - shared: path.resolve(__dirname, 'shared'), + shared: path.resolve(__dirname, '../shared'), 'boundless-utils-omit-keys': 'boundless-utils-omit-keys/build', 'boundless-utils-uuid': 'boundless-utils-uuid/build' } diff --git a/webpack.config.dev.js b/config/webpack.dev.js similarity index 92% rename from webpack.config.dev.js rename to config/webpack.dev.js index 94519629..42a0689c 100644 --- a/webpack.config.dev.js +++ b/config/webpack.dev.js @@ -3,7 +3,7 @@ var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); -const commonWebpackConfig = require('./webpack.config'); +const commonWebpackConfig = require('./webpack.base'); const developmentWebpackConfig = Object.assign(commonWebpackConfig, { cache: true, diff --git a/webpack.config.prod.js b/config/webpack.prod.js similarity index 88% rename from webpack.config.prod.js rename to config/webpack.prod.js index 95cb0e54..c3486447 100644 --- a/webpack.config.prod.js +++ b/config/webpack.prod.js @@ -4,14 +4,14 @@ var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); -commonWebpackConfig = require('./webpack.config'); +commonWebpackConfig = require('./webpack.base'); productionWebpackConfig = Object.assign(commonWebpackConfig, { cache: true, devtool: 'source-map', entry: ['babel-polyfill', 'babel-regenerator-runtime', './app/index'], output: { - path: path.join(__dirname, 'dist'), + path: path.join(__dirname, '../dist'), filename: 'bundle.[hash].js', publicPath: '/static/', }, @@ -26,9 +26,7 @@ productionWebpackConfig.plugins.push( ); productionWebpackConfig.plugins.push( new webpack.optimize.UglifyJsPlugin({ - compress: { - sourceMap: true, - }, + sourceMap: true, }) ); productionWebpackConfig.plugins.push( diff --git a/package.json b/package.json index a051ab87..1d3583ed 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "main": "index.js", "scripts": { "clean": "rimraf dist", - "build:webpack": "NODE_ENV=production webpack --config webpack.config.prod.js", - "build:analyze": "NODE_ENV=production webpack --config webpack.config.prod.js --json | webpack-bundle-size-analyzer", + "build:webpack": "NODE_ENV=production webpack --config config/webpack.prod.js", + "build:analyze": "NODE_ENV=production webpack --config config/webpack.prod.js --json | webpack-bundle-size-analyzer", "build": "npm run clean && npm run build:webpack", "start": "NODE_ENV=production node index.js", "dev": "NODE_ENV=development nodemon --watch server index.js", @@ -49,7 +49,7 @@ ], "setupFiles": [ "raf/polyfill", - "/setupJest.js", + "/config/setupJest.js", "/__mocks__/window.js" ] }, @@ -202,4 +202,4 @@ "raf": "^3.4.0", "react-test-renderer": "^16.1.0" } -} +} \ No newline at end of file diff --git a/server/index.js b/server/index.js index dd5c13a7..3813b4e1 100644 --- a/server/index.js +++ b/server/index.js @@ -21,7 +21,7 @@ if (process.env.NODE_ENV === 'development') { const webpack = require('webpack'); const devMiddleware = require('koa-webpack-dev-middleware'); const hotMiddleware = require('koa-webpack-hot-middleware'); - const config = require('../webpack.config.dev'); + const config = require('../config/webpack.dev'); const compile = webpack(config); /* eslint-enable global-require */