diff --git a/README.md b/README.md index 0d1af0a..fdc8162 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This is a React/Redux single page app that can be used as boilerplate for any starting project, or simply for educational purposes. +**NOTE: This boilerplate is years old (which in the frontend world is like decades old), and at this point is outdated. Webpack, Babel, React-Router, etc. all need to be upgraded (unfortunately not as trivial as changing versions). Thus I do not recommend using this boilerplate beyond simply being a reference. + ### Features: * Universal/Isomorphic rendering diff --git a/webpack/development/dev.config.js b/webpack/development/dev.config.js index 1b92cec..e075f5b 100644 --- a/webpack/development/dev.config.js +++ b/webpack/development/dev.config.js @@ -3,8 +3,6 @@ var webpack = require('webpack') const ROOT = '../..' const PORT = require(ROOT + '/config/serverConfig.json').PORT -require('../symlinks')() - var configVars = { NODE_ENV: JSON.stringify('development'), BROWSER: JSON.stringify(true) @@ -24,6 +22,13 @@ module.exports = { filename: 'js/main.bundle.js', publicPath: `http://localhost:${PORT}/` }, + resolve: { + alias: { + Src: path.join(__dirname, ROOT + '/src'), + Config: path.join(__dirname, ROOT + '/config'), + }, + extensions: ['.js', '.jsx'] + }, plugins: [ new webpack.LoaderOptionsPlugin({ debug: true, diff --git a/webpack/production/prod.config.js b/webpack/production/prod.config.js index 43aeda6..9392ebf 100644 --- a/webpack/production/prod.config.js +++ b/webpack/production/prod.config.js @@ -6,9 +6,7 @@ var WebpackMd5Hash = require('webpack-md5-hash') //required for ChunkManifestPlu var ManifestPlugin = require('webpack-manifest-plugin') const ROOT = '../..' -require('../symlinks')() - -const VERSION = require(ROOT + '/package.json').version || '0.0.0' +// const VERSION = require(ROOT + '/package.json').version || '0.0.0' var configVars = { NODE_ENV: JSON.stringify('production'), @@ -16,7 +14,7 @@ var configVars = { } const config = require(ROOT + '/config/config.js')['production'] -const { STATIC_URL } = config +// const { STATIC_URL } = config module.exports = { context: path.resolve(__dirname, ROOT), @@ -41,6 +39,13 @@ module.exports = { filename: 'js/[name]_[chunkhash]_bundle.js', chunkFilename: 'js/[name]_[chunkhash]_chunk.js' }, + resolve: { + alias: { + Src: path.join(__dirname, ROOT + '/src'), + Config: path.join(__dirname, ROOT + '/config'), + }, + extensions: ['.js', '.jsx'] + }, plugins: [ new webpack.LoaderOptionsPlugin({ minimize: true, diff --git a/webpack/symlinks.js b/webpack/symlinks.js deleted file mode 100644 index a627365..0000000 --- a/webpack/symlinks.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Symlinks: - * - * @app -> if dev then src folder, if prod then bin folder - * @static -> static - * - * Note: Symlink also in package.json because @app needs to point to bin after compilation - * when running production - */ - -const execSync = require('child_process').execSync - -module.exports = function () { - execSync("rm -rf node_modules/@app && ln -sf ../src node_modules/@app") - execSync("[ -h ./node_modules/@static ] || ln -sf ../static ./node_modules/@static") - execSync("[ -h ./node_modules/@config ] || ln -sf ../config ./node_modules/@config") -} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 9ae4a6f..462a223 100644 --- a/yarn.lock +++ b/yarn.lock @@ -777,6 +777,10 @@ balanced-match@^0.4.1, balanced-match@^0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + base64-js@^1.0.2: version "1.2.0" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.0.tgz#a39992d723584811982be5e290bb6a53d86700f1" @@ -848,6 +852,13 @@ brace-expansion@^1.0.0: balanced-match "^0.4.1" concat-map "0.0.1" +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + braces@^1.8.2: version "1.8.5" resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" @@ -2144,8 +2155,8 @@ fstream-ignore@~1.0.5: minimatch "^3.0.0" fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" + version "1.0.12" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.12.tgz#4e8ba8ee2d48be4f7d0de505455548eae5932045" dependencies: graceful-fs "^4.1.2" inherits "~2.0.0" @@ -2243,6 +2254,17 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@~7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.3: + version "7.1.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.5.tgz#6714c69bee20f3c3e64c4dd905553e532b40cdc0" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + global@^4.3.0: version "4.3.1" resolved "https://registry.yarnpkg.com/global/-/global-4.3.1.tgz#5f757908c7cbabce54f386ae440e11e26b7916df" @@ -2300,8 +2322,8 @@ got@^3.2.0: timed-out "^2.0.0" graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" "graceful-readlink@>= 1.0.0": version "1.0.1" @@ -2470,14 +2492,18 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" @@ -3181,6 +3207,12 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: dependencies: brace-expansion "^1.0.0" +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -4779,10 +4811,10 @@ right-align@^0.1.1: align-text "^0.1.1" rimraf@2, rimraf@^2.2.8: - version "2.6.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" dependencies: - glob "^7.0.5" + glob "^7.1.3" rimraf@~2.5.1, rimraf@~2.5.4: version "2.5.4"