1

I have a systemjs build for a typescript web project. There are a lot of tiny files from 3rd party dependencies - i've bundled those up using webpack into a vendor.bundle.js file. I just want to use systemjs to load up and transpile my project typescript files + angular2 and load the 3rd party deps with a single load of the vendor bundle. That will minimize the number of rest calls and make page refreshing much quicker as i develop. Currently, I load the bundle in my index.html with <script src="scripts/vendor.bundle.js"></script>, but systemjs still tries to import 3rd party deps via individual rest calls. any idea how to get systemjs to respect the vendor bundle?

E.g. In my vendor bundle i have things like bootstrap.js, but systemjs will still try to load it when running import 'bootstrap'; giving me a 404: https://localhost:8081/bootstrap.js 404 ()

Here's the Systemjs config:

{ "transpiler": "typescript", "defaultJSExtension": false, "map": { "app": "./scripts", "@angular": "node_modules/@angular", "rxjs": "node_modules/rxjs",
}, "packages": { "app": { "defaultExtension": "ts", "main": "main" }, "rxjs": { "main": "Rx.js", "defaultExtension": "js" }, "@angular/common": { "main": "/bundles/common.umd.js", "defaultExtension": "js" }, "@angular/compiler": { "main": "/bundles/compiler.umd.js", "defaultExtension": "js" }, "@angular/core": { "main": "/bundles/core.umd.js", "defaultExtension": "js" }, "@angular/forms": { "main": "/bundles/forms.umd.js", "defaultExtension": "js" }, "@angular/http": { "main": "/bundles/http.umd.js", "defaultExtension": "js" }, "@angular/platform-browser": { "main": "/bundles/platform-browser.umd.js", "defaultExtension": "js" }, "@angular/platform-browser-dynamic": { "main": "/bundles/platform-browser-dynamic.umd.js", "defaultExtension": "js" }, "@angular/router": { "main": "/bundles/router.umd.js", "defaultExtension": "js" } }, "typescriptOptions": { "emitDecoratorMetadata": true, "experimentalDecorators": true, "module": "commonjs", "tsconfig": true }, "meta": { "typescript": { "exports": "ts" } }, "defaultJSExtensions": true }

Tucker
  • 7,017
  • 9
  • 37
  • 55
  • i abandoned systemjs and now just do my dev work using webpack + awesome `awesome-typescript-loader` and `CommonsChunkPlugin` and the watch option and it works a million times better – Tucker Oct 10 '17 at 16:47
  • See https://stackoverflow.com/questions/37862457/how-to-bundle-angular-2-typescript-app-using-gulp-and-systemjs – Matthieu Jul 05 '18 at 15:19

0 Answers0