Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
fix(approot): attempt to eliminate APP_ROOT env var
Browse files Browse the repository at this point in the history
  • Loading branch information
ostowe committed Mar 2, 2022
1 parent 8388086 commit 82671f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 2 additions & 3 deletions packages/core/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require('dotenv').config();
const {
PROXY_URL,
ROOT_URL,
APP_ROOT,
BUILD_CONTEXT,
} = process.env;

Expand All @@ -16,8 +15,8 @@ const {
const buildContext = BUILD_CONTEXT || fs.realpathSync(process.cwd());

// Root of user app and root of irving core.
const appRoot = APP_ROOT || fs.realpathSync(process.cwd());
const irvingRoot = path.join(__dirname, '../');
const appRoot = fs.realpathSync(process.cwd());
const irvingRoot = path.join(buildContext, 'node_modules/@irvingjs/core');

// Path to irving core relative to the appRoot.
const appIrvingRoot = path.join(
Expand Down
5 changes: 0 additions & 5 deletions packages/core/config/webpack/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const ESLintPlugin = require('eslint-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { rootUrl } = require('../paths');
const proxyPassthrough = require('../proxyPassthrough');
const { maybeResolveUserModule } = require('../../utils/userModule');
const eslintConfig = require('../../.eslintrc.js');

/**
Expand All @@ -27,10 +26,6 @@ module.exports = function getPlugins(context, argv) {
// more deeply customize app and error templates.
const commonPlugins = [
new webpack.DefinePlugin({
appView: JSON.stringify(maybeResolveUserModule('server/views/app.ejs')),
errorView: JSON.stringify(
maybeResolveUserModule('server/views/error.ejs'),
),
proxyPassthrough: JSON.stringify(proxyPassthrough),
}),
new webpack.EnvironmentPlugin({
Expand Down
4 changes: 3 additions & 1 deletion packages/core/server/serverRenderer.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Global passed in via webpack define plugin
/* global appView, errorView */
import React from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
Expand All @@ -20,7 +19,10 @@ import createRouteLogTags from 'utils/createRouteLogTags';
import getWebpackAssetTags from './utils/getWebpackAssetTags';
import getTemplateVars from './utils/getTemplateVars';
import encodeState from './utils/encodeState';
import { maybeResolveUserModule } from '../utils/userModule';

const appView = maybeResolveUserModule('server/views/app.ejs');
const errorView = maybeResolveUserModule('server/views/error.ejs');
const monitor = getMonitorService();
const log = getLogService('irving:server:render');

Expand Down

0 comments on commit 82671f4

Please sign in to comment.