我有一个非常基本的config.js文件,按预期工作,只要它部署在根URL下.这是示例config.js文件:
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
//map tells the System loader where to look for things
map: {
app: "./src",
},
//packages defines our app package
packages: {
app: {
main: './app.ts',
defaultExtension: 'ts'
}
}
});
Run Code Online (Sandbox Code Playgroud)
只要从根路径加载此文件<script src="/config.js">并且位置为
http://localhost/config.js和http://localhost/src/app.ts,它一切正常.
我现在正试图将config.js文件移动到更深的目录并加载它,如:<script src="/a/b/c/d/e/config.js">,但如果我这样做,那么我需要硬编码config.js文件本身的路径,如:
//map tells the System loader where to look for things
map: {
app: …Run Code Online (Sandbox Code Playgroud)