jspm-watch icon indicating copy to clipboard operation
jspm-watch copied to clipboard

After installing a module, it is not recognized when trying to import

Open NervosaX opened this issue 8 years ago • 7 comments

This is in the test project:

  • Ran gulp watch
  • jspm install npm:react
  • add line import React from 'react';

Get the following error:

[BS] Reloading Browsers...
[15:36:36] JSPM Watch: Module 'app/app.js' was changed.
[15:36:36] JSPM Watch: Building app (1 module was changed)...
[15:36:36] JSPM Watch: App build failed
Error: Error on fetch for react.js at file:///home/adam/Programming/js/jspm-watch/test-project/client/react.js
        Loading app/app.js
        ENOENT: no such file or directory, open '/home/adam/Programming/js/jspm-watch/test-project/client/react.js'

NervosaX avatar Mar 30 '16 04:03 NervosaX

True, it doesn't seem to work as expected. Investigating.

fyodorvi avatar Mar 30 '16 06:03 fyodorvi

Fixed in 0.1.9, please update.

Fix is a hell of a hack, actually. It turned out that re-instantiating SystemJS Builder is not enough, because it grabs config upon require. So I have to invalidate jspm module from node cache an re-require it after config was changed. Which may possible effect on memory usage.

fyodorvi avatar Mar 30 '16 08:03 fyodorvi

Well, it seems to work fine now. I successfully installed a dependency without having to restart the application. Uninstalling seems to work, too.

NervosaX avatar Mar 30 '16 21:03 NervosaX

Hrm, I still seem to be getting this one on the latest version. Install file, it recalcs and throws an error. I'm not sure why it was successful the last time.

NervosaX avatar Apr 14 '16 07:04 NervosaX

Invalidating npm module from cache seems to be buggy. On a massive project which I have it works only 3-4 times and then fails with memory usage overflow. So I've decided to move bundling on to a separate node process, which benefits with a bit faster bundling and super safe full project rebuild - I just kill the process and start a new one. It's published in JSPM Watch 0.3.0-beta, you may try it, however there's an issue with file events processing in batches, which shouldn't be to critical, but it requires fixing, that's why it's 0.3.0 is in beta.

fyodorvi avatar May 08 '16 23:05 fyodorvi

Yeah, if there wasn't going to be any more updates on your end, I was going to attempt something similar. The project is extremely handy, by the way. Especially coupled with jspm 0.17. I'll have a try with the beta and see how that goes when I have some time.

Edit: Actually, I'm currently running a modified version with the pull requests I've made. Some of my tasks will just fail without them, so I'll have to wait.

NervosaX avatar May 09 '16 00:05 NervosaX

So far so good with the 0.3.0-beta branch. Will trial it for a while and see how it goes.

NervosaX avatar May 11 '16 03:05 NervosaX