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..cdcc853 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5103,8 +5103,8 @@ string_decoder@^0.10.25, string_decoder@~0.10.x: resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" stringstream@~0.0.4: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + version "0.0.6" + resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.6.tgz#7880225b0d4ad10e30927d167a1d6f2fd3b33a72" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1"