使用redux在lite-server中未定义进程

时间:2016-08-23 20:35:23

标签: angular redux systemjs lite-server

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

(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

1 个答案:

答案 0 :(得分: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' },
};