Angular 2 + Typescript compiler copy html and css files

后端 未结 7 1176
清酒与你
清酒与你 2020-12-05 07:01

In Angular2 I would have

\"outDir\": \"dist/app\"

in tsconfig.json. As a result the transpiled .js and .map files are generated in /di

7条回答
  •  粉色の甜心
    2020-12-05 07:20

    As an alternative from my detailed answer here: https://stackoverflow.com/a/40694657/986160 could be to leave your css and html with the ts files. Then you can use module.id which will have the path pointing to the js of the component and after converting it accordingly you can essentially use relative paths :)

    For your case I think something like that will work:

    @Component({
       moduleId: module.id.replace("/dist/", "/"),
    ...
    });
    

提交回复
热议问题