0

当使用来自 Angular 2 RC.5 的默认 SystemJS 配置时,如果添加为依赖项,lite-server 会抛出进程未定义的错误。redux有没有人经历过这个?这是跟踪堆栈:

(index):43 Error: ReferenceError: process is not defined at Object.eval (http://localhost:3000/node_modules/redux/lib/index.js:38:5) at eval (http://localhost:3000/node_modules/redux/lib/index.js:47:4) at eval (http://localhost:3000/node_modules/redux/lib/index.js:48:3) at Object.eval (http://localhost:3000/node_modules/ng2-redux/lib/components/ng-redux.js:14:15) Evaluating http://localhost:3000/node_modules/redux/lib/index.js Evaluating http://localhost:3000/node_modules/ng2-redux/lib/components/ng-redux.js Evaluating http://localhost:3000/node_modules/ng2-redux/lib/index.js Evaluating http://localhost:3000/actions/session.actions.js Evaluating http://localhost:3000/app/app.component.js Evaluating http://localhost:3000/app/app.module.js Evaluating http://localhost:3000/app/main.js Error loading http://localhost:3000/app/main.js

4

1 回答 1

3

对于 Stack Overflow 记录,重复我对 github 上相同问题的回答:https ://github.com/angular-redux/ng2-redux/issues/202

试着把它放在 system.config.js 中:

var map = {
  /* ... */
  'ng2-redux': 'node_modules/ng2-redux',
  'redux':     'node_modules/redux',
};

var packages = {
  /* ... */
  'ng2-redux': { main: 'lib/index.js', defaultExtension: 'js' },
  'redux':     { main: 'dist/redux.js', defaultExtension: 'js' },
};
于 2016-08-24T02:06:23.917 回答