rxjs: ES6: Cannot resolve module 'rxjs/Rx' for rxjs-es

Rxjs: v5 beta 4 npm: 3.7.3 node: 5.9.1

Code to reproduce:

  • Create a new Webpack + Babel 5 project using babel-preset-es2015
  • npm install rxjs-es --save
  • Add import Rx from 'rxjs/Rx'; to JS file
  • Webpack buid: Module not found: Error: Cannot resolve module 'rxjs/Rx' in /home/jadbox/github/rxjs5proj

Node Modules: ls -ls node_modules | grep rxjs 4 drwxr-xr-x 11 jadbox jadbox 4096 Apr 1 11:36 rxjs-es

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 13
  • Comments: 25 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Yea, I don’t believe it’s getting bundled. That makes sense, there is likely some .babelrc configuration to say “transpile node_modules too”. After changing my import to the correct one mentioned by @blesh, I see SyntaxError: Unexpected reserved word on “import” node_modules/rxjs-es/Observable.js:1.

I’m closing this issue for now, by believing this is related with transpiling ES2015 module package.

Summarize, please check this.

  • Please check transpiler configuration to pickup rxjs-es as well while transpiling. rxjs-es is native ES2015 module, cannot be consumed without transpilation (at this moment)
  • if it’s hard to configure transpiling configuration for dependency package, please consider to use cjs package instead.

@kwonoj definitely, and hey, I’ll admit to not reading the README to the point where there are instructions for common 😝

The build goes correctly, but then during execution: Error: Cannot find module ‘rxjs/Observable’

That should be rxjs-es/Observable if you installed rxjs-es.