Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38819
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Arno Welzel <usenet@arnowelzel.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Using a single module |
| Date | Sun, 20 Sep 2020 11:26:17 +0200 |
| Lines | 34 |
| Message-ID | <hsolhpF9ljhU1@mid.individual.net> (permalink) |
| References | <67Wdnb4wtM6Kr_nCnZ2dnUU7-aPNnZ2d@westnet.com.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net A9fqo4TmC+ePIfpbHyQq8wbyi61GFYgpREwNwoAk0RTUS4ANJ8 |
| Cancel-Lock | sha1:IMQvytSD/FaH0/8VUGJPTLjkv0E= |
| In-Reply-To | <67Wdnb4wtM6Kr_nCnZ2dnUU7-aPNnZ2d@westnet.com.au> |
| Xref | csiph.com comp.lang.javascript:38819 |
Show key headers only | View raw
Andrew Poulos:
> I'm trying my first use of modules and there some concepts that escape
> me despite goog's help.
>
> If I find an ES module I'd like to use I can add it to the head of the
> page eg
> <script type="module" src="modules/jspdf.es.min.js"></script>
>
> To use it in my code I need the script element that includes index.js to
> have type="module" eg
> <script type="module" src="scripts/index.js"></script>
>
> In index.js I have: import { ...
Why do you import a module within another module? The idea is to have a
script and one or more modules - but not modules importing other modules.
Also see:
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules>
[...]
> So I end up with every script element having type="module" and every js
> file exporting functions even though there's only one actual module I'd
> like to use. Is that correct or am I missing something?
See above. Do not create modules importing other modules but only *one*
script which imports one or more modules.
--
Arno Welzel
https://arnowelzel.de
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Using a single module Andrew Poulos <ap_prog@hotmail.com> - 2020-09-18 14:05 +1000
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-18 04:40 -0700
Re: Using a single module Andrew Poulos <ap_prog@hotmail.com> - 2020-09-20 15:27 +1000
Re: Using a single module Arno Welzel <usenet@arnowelzel.de> - 2020-09-20 11:27 +0200
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-20 02:38 -0700
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-20 02:51 -0700
Re: Using a single module "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-09-18 11:06 -0700
Re: Using a single module Andrew Poulos <ap_prog@hotmail.com> - 2020-09-20 15:27 +1000
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-20 02:46 -0700
Re: Using a single module Arno Welzel <usenet@arnowelzel.de> - 2020-09-20 11:26 +0200
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-20 02:42 -0700
Re: Using a single module Arno Welzel <usenet@arnowelzel.de> - 2020-09-24 19:34 +0200
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-24 11:16 -0700
Re: Using a single module Arno Welzel <usenet@arnowelzel.de> - 2020-09-24 20:44 +0200
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-24 11:59 -0700
Re: Using a single module Scott Sauyet <scott.sauyet@gmail.com> - 2020-09-24 19:55 -0700
Re: Using a single module Julio Di Egidio <julio@diegidio.name> - 2020-09-24 20:13 -0700
Re: Using a single module Arno Welzel <usenet@arnowelzel.de> - 2020-09-26 23:37 +0200
Re: Using a single module Scott Sauyet <scott.sauyet@gmail.com> - 2020-09-26 15:41 -0700
Re: Using a single module Jon Ribbens <jon+usenet@unequivocal.eu> - 2020-09-26 23:04 +0000
Re: Using a single module Arno Welzel <usenet@arnowelzel.de> - 2020-09-26 23:36 +0200
csiph-web