Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using import from statement with SystemJs

I am trying to build up a sample code using typescript and systemjs (browser).

app.ts file :

import {Person,add as test} from './testLib'

app.js (generated by ts compiler):

 var testLib_1 = require('./testLib');

then

System.import('./app.js')

Causes 404 Error because system.js looks for /js/testLib/ folder rather than /js/testLib.js file.

Any ideas why ?

My tsconfig.js:

"target": "es5",
"module": "commonjs",
like image 404
Ali Salehi Avatar asked Jun 13 '26 02:06

Ali Salehi


1 Answers

Causes 404 Error because system.js looks for /js/testLib/ folder rather than /js/testLib.js file

If you are using system js change module format to system

"module": "system",
like image 93
basarat Avatar answered Jun 18 '26 01:06

basarat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!