alexisvincent / systemjs-hot-reloader

reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
MIT License
228 stars 36 forks source link

systemjs 0.20.x breaking change causing systemjs-hot-reloaded to break #126

Closed Son-Lam closed 7 years ago

Son-Lam commented 7 years ago

Hello,

We have been using systemjs-hot-reloader with Angular2.

Few days ago we upgraded Angular to 4.0.0-beta.5 (which use systemjs 0.20.4 dev), and our HoReloader stops working with following error:

Unhandled Promise rejection: Cannot read property 'System' of undefined Instantiating http://localhost:3474/jspm_packages/github/capaj/systemjs-hot-reloader@0.6.0/hot-reloader.js Loading systemjs-hot-reloader ; Zone: ; Task: Promise.then ; Value: d {zone_symbol__error: Error: Cannot read property 'System' of undefined Instantiating http://localhost:3474/jspm_package…, zone_symbolstack: "TypeError: Cannot read property 'System' of undefi…ckages/npm/zone.js@0.7.6/dist/zone.min.js:1:9937)", originalErr: TypeError: Cannot read property 'System' of undefined at new CompilerHost (http://localhost:3474…, zone_symbolmessage: "Cannot read property 'System' of undefined↵ Insta…0/hot-reloader.js↵ Loading systemjs-hot-reloader"} TypeError: Cannot read property 'System' of undefined at new CompilerHost (http://localhost:3474/jspm_packages/github/frankwallis/plugin-typescript@4.0.16/compiler-host.js:24:107) at createServices (http://localhost:3474/jspm_packages/github/frankwallis/plugin-typescript@4.0.16/factory.js:60:20) at http://localhost:3474/jspm_packages/github/frankwallis/plugin-typescript@4.0.16/factory.js:12:20 at e.invoke (http://localhost:3474/jspm_packages/npm/zone.js@0.7.6/dist/zone.min.js:1:16549) at t.run (http://localhost:3474/jspm_packages/npm/zone.js@0.7.6/dist/zone.min.js:1:13410) at http://localhost:3474/jspm_packages/npm/zone.js@0.7.6/dist/zone.min.js:1:10891 at e.invokeTask (http://localhost:3474/jspm_packages/npm/zone.js@0.7.6/dist/zone.min.js:1:17226) at t.runTask (http://localhost:3474/jspm_packages/npm/zone.js@0.7.6/dist/zone.min.js:1:14028) at a (http://localhost:3474/jspm_packages/npm/zone.js@0.7.6/dist/zone.min.js:1:9937) o @ zone.min.js:1 a @ zone.min.js:1 a @ zone.min.js:1 zone.min.js:1 d {__zone_symbolerror: Error: Uncaught (in promise): Error: Cannot read property 'System' of undefined Instantiating http…, rejection: d, promise: e, zone: t, task: e} o @ zone.min.js:1 a @ zone.min.js:1 a @ zone.min.js:1 DevTools failed to parse SourceMap: http://localhost:3474/jspm_packages/system.src.js.map


NOTES from systemjs 0.20.0 release:

SystemJS 0.20 is a rewrite of SystemJS on top of the 2.0 release of es-module-loader. It remains as backwards-compatible as possible, while also tracking the changes of direction that have been happening at the specification level.

There are a number of breaking changes and deprecations as listed below.

To upgrade, first run SystemJS 0.19 with System.config({ warnings: true }) and fix all the deprecation warnings first before running SystemJS 0.20.

The corresponding release of SystemJS Builder is available at https://github.com/systemjs/builder/releases/tag/0.16.0.

For background on this release, see the blog post at http://guybedford.com/systemjs-alignment.

New Features:

Improved performance and reduced file size. Supports the dynamic import('./module.js') syntax in modules, when transpiled with the Babel system module format with the babel-plugin-syntax-dynamic-import plugin enabled (alternatively this support is also provided by the SystemJS babel plugin). Supports automatically loading Web Assembly when enabled via the flag System.config({ wasm: true }) New small optimized production build (5KB) for just loading System.register modules with baseURL, paths, map, contextual map, bundles, depCache and wasm support. Normalization is now fully idempotent format: 'system' is supported as an alternative to format: 'register' Breaking Changes:

Removes the ability to use named imports from non-ES modules (eg import {readFile} from 'fs' should be import fs from 'fs'; fs.readFile). This is in order to align with the NodeJS ES module directions (https://github.com/nodejs/CTC/pull/60/files#diff-2b572743d67d8a47685ae4bcb9bec651R217). Removes support for defaultJSExtensions Default transpiler loading is removed. It is no longer possible to transpile sources without configuring one of the transpiler plugins. Setting baseURL directly is no longer supported - use System.config({ baseURL: 'x' }) over System.baseURL = x. No longer possible to set System.map['x'] = 'asdf'. Must use System.config({ map: { x: 'asdf' } }). Hooks no longer exist (just resolve and instantiate as in es-module-loader). Hooks via plugins still work fine. Supports IE9+ but scriptLoad support is only included in IE11+ deps is no longer supported for System.register / System.registerDynamic / script load Global exports metadata as an array will no longer export the default as the first global. format: 'esm' must now be used instead of format: 'es6' A bundle with a single named System.register statement will no longer give an anonymous module value No more special handling of trailing slash in CJS System.load now does normalization, to match WhatWG spec. This method may well be deprecated as idempotent normalization should make this no longer necessary. AMD define no longer set by default when using scriptLoad, requires manually setting window.define = System.amdDefine for scriptLoad support of AMD. The separate SystemCSP and register builds are no longer available Disables a previous experimental functional return variation of System.register Alias feature is removed System and SystemJS globals are no longer defined in NodeJS Bug Fixes

depCache now uses link preloading instead of partial execution techniques which have been unreliable.

alexisvincent commented 7 years ago

@Son-Lam Yeah, systemjs-hmr, doesn't yet support SystemJS 20, for a number of reasons. Mostly because the trace API we use has changed now. My advice for the moment would be to switch back to the older version. I might be able to build in support this weekend, but don't count on it.

alexisvincent commented 7 years ago

When we ship systemjs-hot-reloader 1.0 this will be supported. Should be within the next 2 weeks. Sooner if theres large demand.

Son-Lam commented 7 years ago

Thanks a lot @alexisvincent. Can't wait for your update.

adelespinasse commented 7 years ago

Is this why the hot reloader is broken in jspm 0.17.0-beta.38? I assume I can probably go back to beta.37 or so and continue to work for now?

EDIT: Actually had to go all the way back to 0.17.0-beta.32.

alexisvincent commented 7 years ago

If beta 32 uses SystemJS 20 then yes. Sorry, will get to this as soon as possible

alexisvincent commented 7 years ago

@guybedford, thought you should know about this

icode commented 7 years ago

I encountered the same problem, please update as soon as possible, thank you

guybedford commented 7 years ago

Thanks @alexisvincent for the update. Just let me know if there is anything I can do to assist.

eastlondoner commented 7 years ago

+1 unfortunately. What's the situation? Happy to assist.

alexisvincent commented 7 years ago

I'll write up an issue describing where I am and what needs to happen to fix this up. Need some input still from @guybedford and @capaj.

alexisvincent commented 7 years ago

Tracking here

alexisvincent commented 7 years ago

SystemJS 20 support released in https://github.com/alexisvincent/systemjs-hot-reloader/releases/tag/v1.0.0.

Son-Lam commented 7 years ago

Thanks so much, for quick response.

We will try and let you know if we see any problem.

alexisvincent commented 7 years ago

Awesome :)