Skip to content

Commit ebf453f

Browse files
committed
FIX: The real fix of requireWeak(..) use compatibility with npm link?
1 parent afaf54e commit ebf453f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

config/webpack/lib-base.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ module.exports = function configFactory(ops) {
5959
'url-parse',
6060
],
6161
mode: ops.mode,
62-
node: {
63-
__dirname: false,
64-
},
6562
output: {
6663
filename: 'index.js',
6764

package.json

Lines changed: 3 additions & 3 deletions
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/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",
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",
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import * as utils from 'utils';
1818

1919
import { requireWeak } from 'utils/webpack';
2020

21-
const serverUrl = path.resolve(__dirname, './server');
21+
const serverUrl = module.webpackPolyfill ? './server'
22+
: path.resolve(__dirname, './server');
2223
const server = utils.isomorphy.isServerSide() ? requireWeak(serverUrl) : null;
2324

2425
export {

src/shared/utils/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import * as isomorphy from './isomorphy';
55
import * as redux from './redux';
66
import * as webpack from './webpack';
77

8-
const juUrl = path.resolve(__dirname, './jest');
8+
const juUrl = module.webpackPolyfill ? './shared/utils/jest'
9+
: path.resolve(__dirname, './jest');
10+
911
const JU = isomorphy.isServerSide() ? webpack.requireWeak(juUrl) : null;
1012

1113
export {

0 commit comments

Comments
 (0)