File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
docs/documentation/stories Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,23 @@ You can also rename the output and lazy load it by using the object format:
2121 { "input" : " pre-rename-script.js" , "output" : " renamed-script" },
2222],
2323```
24+
25+ ## Using global libraries inside your app
26+
27+ Once you import a library via the scripts array, you should ** not** import it via a import statement
28+ in your TypeScript code (e.g. ` import * as $ from 'jquery'; ` ).
29+ If you do that, you'll end up with two different copies of the library: one imported as a
30+ global library, and one imported as a module.
31+
32+ This is especially bad for libraries with plugins, like JQuery, because each copy will have
33+ different plugins.
34+
35+ Instead, download typings for your library (` npm install @types/jquery ` ) which will give you
36+ access to the global variables exposed by that library.
37+
38+ If the global library you need to use does not have global typings, you can also declare them
39+ manually in ` src/typings.d.ts ` as ` any ` :
40+
41+ ```
42+ declare var libraryName: any;
43+ ```
You can’t perform that action at this time.
0 commit comments