Title: Including a 3rd party lib · Issue #999 · angular/angular-cli · GitHub
Open Graph Title: Including a 3rd party lib · Issue #999 · angular/angular-cli
X Title: Including a 3rd party lib · Issue #999 · angular/angular-cli
Description: I have looked at a number of different issues (#274, #785, #845) and the wiki page (https://github.com/angular/angular-cli/wiki/3rd-party-libs) and I still cannot get a simple JS file to work in my project. I'm trying to use filesaver.js...
Open Graph Description: I have looked at a number of different issues (#274, #785, #845) and the wiki page (https://github.com/angular/angular-cli/wiki/3rd-party-libs) and I still cannot get a simple JS file to work in my...
X Description: I have looked at a number of different issues (#274, #785, #845) and the wiki page (https://github.com/angular/angular-cli/wiki/3rd-party-libs) and I still cannot get a simple JS file to work in my...
Mail addresses
notifications@github.com
notifications@github.com
Opengraph URL: https://github.com/angular/angular-cli/issues/999
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Including a 3rd party lib","articleBody":"I have looked at a number of different issues (https://github.com/angular/angular-cli/issues/274, https://github.com/angular/angular-cli/issues/785, https://github.com/angular/angular-cli/issues/845) and the wiki page (https://github.com/angular/angular-cli/wiki/3rd-party-libs) and I still cannot get a simple JS file to work in my project.\n\nI'm trying to use [filesaver.js](https://www.npmjs.com/package/filesaver.js) in my app. My \n\nangular-cli-build.js\n\n```\n/* global require, module */\n\nvar Angular2App = require('angular-cli/lib/broccoli/angular2-app');\n\nmodule.exports = function(defaults) {\n return new Angular2App(defaults, {\n vendorNpmFiles: [\n 'systemjs/dist/system-polyfills.js',\n 'systemjs/dist/system.src.js',\n 'zone.js/dist/*.js',\n 'es6-shim/es6-shim.js',\n 'reflect-metadata/*.js',\n 'rxjs/**/*.js',\n '@angular/**/*.js',\n 'filesaver.js/FileSaver.js'\n ]\n });\n};\n```\n\nmy system-config.ts\n\n```\n/***********************************************************************************************\n * User Configuration.\n **********************************************************************************************/\n/** Map relative paths to URLs. */\nconst map: any = {\n 'filesaverjs': 'vendor/filesaver.js',\n};\n\n/** User packages configuration. */\nconst packages: any = {\n 'filesaverjs': {defaultExtension: 'js', main: 'FileSaver'},\n};\n```\n\nI installed the package with npm:\n\n```\njeff@computer:~/dev/myProj$ ls ./node_modules/filesaver.js/\ndemo FileSaver.js FileSaver.min.js LICENSE.md package.json README.md\n```\n\nIt shows up in my vendor folder:\n\n```\njeff@BenSolo:~/dev/ang_proj/analystToolbox$ ls ./dist/vendor/filesaver.js/\nFileSaver.js FileSaver.min.js\n```\n\nI try to use it in my component, and it `Cannot find module filesaverjs`:\n\n```\n// in file ./src/app/+my-component.component.ts\nimport { Component, OnInit } from '@angular/core';\nimport { FORM_DIRECTIVES } from '@angular/common';\nimport { PlatformDescriptionService } from '../platform-description.service';\nimport * as saver from 'filesaverjs'; // ERROR: Cannot find module 'filesaverjs'.\n```\n\n**What am I missing?**\n## Useful info:\n### OS?\n\nLinux Ubuntu \n### Versions.\n\n```\n$ ng --version\nCould not start watchman; falling back to NodeWatcher for file system events.\nVisit http://ember-cli.com/user-guide/#watchman for more info.\nangular-cli: 1.0.0-beta.5\nnode: 5.10.1\nos: linux x64\n```\n### Repro steps.\n1. run this:\n \n ng testProj\n cd ./testProj\n npm install filesaver.js --save\n2. make the changes outlined above to `system-config.js` and `angular-cli-build.js`\n3. run `ng build`\n4. edit `./src/app/test-proj.component.ts`:\n \n //add this line:\n 'filesaverjs': {defaultExtension: 'js', main: 'FileSaver'},\n5. `ng build` or `ng build`:\n\n```\njeff@BenSolo:~/dev/ang_proj/testProj$ ng serve\nCould not start watchman; falling back to NodeWatcher for file system events.\nVisit http://ember-cli.com/user-guide/#watchman for more info.\nLivereload server on http://localhost:49152\nServing on http://localhost:4200/\nThe Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:\nError: Typescript found the following errors:\n /home/jeff/dev/ang_proj/testProj/tmp/broccoli_type_script_compiler-input_base_path-gJxDieIo.tmp/0/src/app/test-proj.component.ts (2, 28): Cannot find module 'filesaverjs'.\n at BroccoliTypeScriptCompiler._doIncrementalBuild (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:115:19)\n at BroccoliTypeScriptCompiler.build (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:43:10)\n at /home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21\n at lib$rsvp$$internal$$tryCatch (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1036:16)\n at lib$rsvp$$internal$$invokeCallback (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1048:17)\n at lib$rsvp$$internal$$publish (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1019:11)\n at lib$rsvp$asap$$flush (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1198:9)\n at _combinedTickCallback (internal/process/next_tick.js:67:7)\n at process._tickCallback (internal/process/next_tick.js:98:9)\n\nThe broccoli plugin was instantiated at: \n at BroccoliTypeScriptCompiler.Plugin (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)\n at BroccoliTypeScriptCompiler.CachingWriter [as constructor] (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)\n at BroccoliTypeScriptCompiler (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:26:49)\n at Angular2App._getTsTree (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/lib/broccoli/angular2-app.js:321:18)\n at Angular2App._buildTree (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/lib/broccoli/angular2-app.js:116:23)\n at new Angular2App (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)\n at module.exports (/home/jeff/dev/ang_proj/testProj/angular-cli-build.js:6:10)\n at Class.module.exports.Task.extend.setupBroccoliBuilder (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)\n at Class.module.exports.Task.extend.init (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)\n at new Class (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)\n at Class.module.exports.Task.extend.run (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/serve.js:15:19)\n at /home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/lib/commands/serve.js:64:24\n at lib$rsvp$$internal$$tryCatch (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)\n at lib$rsvp$$internal$$invokeCallback (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)\n at /home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11\n at lib$rsvp$asap$$flush (/home/jeff/dev/ang_proj/testProj/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)\n```\n","author":{"url":"https://github.com/jdell64","@type":"Person","name":"jdell64"},"datePublished":"2016-06-03T16:53:16Z","url":"https://github.com/angular/angular-cli/issues/999"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:da30ce74-755d-3cf7-dbb5-d959dfd88c75 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF6C:3A6E49:2132023:2BDB4AC:6B057784 |
| html-safe-nonce | 0ad80d3cd6d8a5ea8dadf3ce96366fe0b22ee76493ace6241c08195586052d89 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjZDOjNBNkU0OToyMTMyMDIzOjJCREI0QUM6NkIwNTc3ODQiLCJ2aXNpdG9yX2lkIjoiNzY4MjU4MzQ2OTcyNDQ0NTQ5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5a93b487acd8ffb4bbeaf660a9d86fd892184132e7054a0212c2aee88986c8ac |
| hovercard-subject-tag | issue:158409558 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/999/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d2439e0d6826615210f4b8936b5aca480adfbcc9d079683d591b48db926314c4/angular/angular-cli/issues/999 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d2439e0d6826615210f4b8936b5aca480adfbcc9d079683d591b48db926314c4/angular/angular-cli/issues/999 |
| og:image:alt | I have looked at a number of different issues (#274, #785, #845) and the wiki page (https://github.com/angular/angular-cli/wiki/3rd-party-libs) and I still cannot get a simple JS file to work in my... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jdell64 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 507b2d62524c0f595c35a2a2ee8a6ec54b119f245b3c59eaa070013b70ed1ada |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e7a883ae3b439b8952652eaa7803e2587f30e339 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width