Closed jamesbrobb closed 6 years ago
Any code importing from my_module
should always go through the package configuration and have the defaultExtension
added to the normalized path that it requests.
There are some edge cases here but what issue are you specifically experiencing?
Got it, thanks again for your help.
I think a lot of the problems i'm experiencing stem from a misunderstanding (on my part), of what the config used for systemjs-builder
should look like, and then exactly what the corresponding systemjs
config used to load those bundled files should also then look like.
I'm glad I could help. It definitely gets complicated and confusing at times.
Versions
systemjs:
0.19.47
systemjs-builder:0.15.34
typescript:2.3.0
Question
With
warnings: true
i get the following warning:Paths configuration "my_module/*" -> "my_module/*.ts" uses wildcards which are being deprecated for just leaving a trailing "/" to indicate folder paths.
In order to fix this i removed the wildcards from the
my_module
paths config and addeddefaultExtension: 'ts'
to packages:So:
has become:
This (as far as i can understand) is what's specified as the fix for this in the warning message and now the warning message is gone. Without the
defaultExtension: 'ts'
it attempts to load.js
files, so i'm presuming this is also required?Problem
Using this format adds
.ts
onto all of the systemjs register paths and import statements once transpiled. So any other code that attempts toimport MyClass from 'my_module'
without the.ts
will fail to find them in the register and error attempting to loadmy_module/MyClass
So whereas when using wildcards the output would be:
Without the wildcards and only a trailing slash and
defaultExtension: 'ts'
it outputs:Using plugin-typescript
It has been suggested that i should be using
plugin-typescript
(i'm now using 7.0.6) to ensure that typescript files are handled correctly. However when using trailing slashes instead of wildcards, it ends up with only.ts
on the register keys, but not the imported dependencies:Question
What's the correct way to target and transpile typescript files, so that the
.ts
is not added to the registry keys and imports?