Skip to content

Commit 3c558fd

Browse files
committedDec 24, 2018
FIX: resolveWeak(..) used in the way compatible with npm link
1 parent 48f1ee0 commit 3c558fd

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed
 

‎config/webpack/lib-base.js

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ module.exports = function configFactory(ops) {
5959
'url-parse',
6060
],
6161
mode: ops.mode,
62+
node: {
63+
__dirname: false,
64+
},
6265
output: {
6366
filename: 'index.js',
6467

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@
123123
},
124124
"scripts": {
125125
"build": "npm run clean && npm run build:dev && npm run build:prod",
126-
"build:dev": "npm run mkDistDir:dev && ./node_modules/.bin/webpack --env=development --bail --colors --display-optimization-bailout --profile --progress && BABEL_ENV=development babel src/server --out-dir dist/dev/server && BABEL_ENV=development babel src/shared/utils/jest.jsx --out-file dist/dev/shared/utils/jest.js && BABEL_ENV=development babel src/client/init.js --out-file dist/dev/client/init.js",
127-
"build:dev:watch": "npm run clean && npm run mkDistDir:dev && (./node_modules/.bin/webpack --env=development --bail --colors --display-optimization-bailout --profile --progress --watch | BABEL_ENV=development babel src/server --out-dir dist/dev/server --watch | BABEL_ENV=development babel src/shared/utils/jest.jsx --out-file dist/dev/shared/utils/jest.js --watch | BABEL_ENV=development babel src/client/init.js --out-file dist/dev/client/init.js --watch)",
128-
"build:prod": "npm run mkDistDir:prod && ./node_modules/.bin/webpack --env=production --colors --display-optimization-bailout --profile --progress && BABEL_ENV=production babel src/server --out-dir dist/prod/server && BABEL_ENV=production babel src/shared/utils/jest.jsx --out-file dist/prod/shared/utils/jest.js && BABEL_ENV=production babel src/client/init.js --out-file dist/prod/client/init.js",
126+
"build:dev": "npm run mkDistDir:dev && ./node_modules/.bin/webpack --env=development --bail --colors --display-optimization-bailout --profile --progress && BABEL_ENV=development babel src/server --out-dir dist/dev/server && BABEL_ENV=development babel src/shared/utils/jest.jsx --out-file dist/dev/jest.js && BABEL_ENV=development babel src/client/init.js --out-file dist/dev/client/init.js",
127+
"build:dev:watch": "npm run clean && npm run mkDistDir:dev && (./node_modules/.bin/webpack --env=development --bail --colors --display-optimization-bailout --profile --progress --watch | BABEL_ENV=development babel src/server --out-dir dist/dev/server --watch | BABEL_ENV=development babel src/shared/utils/jest.jsx --out-file dist/dev/jest.js --watch | BABEL_ENV=development babel src/client/init.js --out-file dist/dev/client/init.js --watch)",
128+
"build:prod": "npm run mkDistDir:prod && ./node_modules/.bin/webpack --env=production --colors --display-optimization-bailout --profile --progress && BABEL_ENV=production babel src/server --out-dir dist/prod/server && BABEL_ENV=production babel src/shared/utils/jest.jsx --out-file dist/prod/jest.js && BABEL_ENV=production babel src/client/init.js --out-file dist/prod/client/init.js",
129129
"clean": "./node_modules/.bin/rimraf dist",
130130
"jest": "NODE_CONFIG_ENV=test jest --no-cache --maxWorkers=4 --config config/jest/default.js",
131131
"lint": "npm run lint:js && npm run lint:scss",

‎src/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from 'path';
2+
13
import 'styles/global.scss';
24

35
import actions from 'actions';
@@ -14,11 +16,9 @@ import reducers from 'reducers';
1416
import ScalableRect from 'components/ScalableRect';
1517
import * as utils from 'utils';
1618

17-
import { isProdBuild } from 'utils/isomorphy';
1819
import { requireWeak } from 'utils/webpack';
1920

20-
let serverUrl = isProdBuild() ? 'prod' : 'dev';
21-
serverUrl = `topcoder-react-utils/dist/${serverUrl}/server`;
21+
const serverUrl = path.resolve(__dirname, './server');
2222
const server = utils.isomorphy.isServerSide() ? requireWeak(serverUrl) : null;
2323

2424
export {

‎src/shared/utils/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import path from 'path';
2+
13
import config from './config';
24
import * as isomorphy from './isomorphy';
35
import * as redux from './redux';
46
import * as webpack from './webpack';
57

6-
let juUrl = isomorphy.isProdBuild() ? 'prod' : 'dev';
7-
juUrl = `topcoder-react-utils/dist/${juUrl}/shared/utils/jest`;
8-
8+
const juUrl = path.resolve(__dirname, './jest');
99
const JU = isomorphy.isServerSide() ? webpack.requireWeak(juUrl) : null;
1010

1111
export {

0 commit comments

Comments
 (0)
Please sign in to comment.