webpack是否打包.angular-cli.json中引用的文件? [英] Does webpack packages files referenced in .angular-cli.json?

查看:87
本文介绍了webpack是否打包.angular-cli.json中引用的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.angular-cli.json中有一个样式"部分和脚本"部分.

There is a "styles" section and "scripts" section in .angular-cli.json.

我在样式"和脚本"部分下添加了一些文件.看来我的角度项目无法识别这些文件.

I have added some files under "styles" and "scripts" sections. It appears that my angular project does not recognise these files.

webpack是否了解.angular-cli.json中的配置?

Is webpack aware of the configurations inside .angular-cli.json?

webpack是否打包在.angular-cli.json的样式"和脚本"部分下引用的文件?如果是,我如何确定它确实在这样做?如何跟踪webpack不打包哪些文件?

Does webpack packages files referenced under "styles" and "scripts" section of .angular-cli.json? If yes, how can I be sure it is actually doing this? How can I trace which files are packed, which files aren't packed by webpack?

以下是我从webpack收到的错误:

Following is the error I receive from webpack:

ERROR in ./src/main/webapp/app/header/header.component.html
Module not found: Error: Can't resolve './dist/img/user2-160x160.jpg' in '/Users/halil/Projects/kodfarki/chargeback2/business-services/src/main/webapp/app/header'
 @ ./src/main/webapp/app/header/header.component.html 1:4961-5000 1:5174-5213
 @ ./src/main/webapp/app/header/header.component.ts
 @ ./src/main/webapp/app/app.module.ts
 @ ./src/main/webapp/app/app.main.ts

以下是我的文件夹结构:

Following is my folder structure:

以下是我的.angular-cli.json定义:

Following is my .angular-cli.json definition:

"apps": [{
    "root": "src/main/webapp/",
    "outDir": "target/www/app",
    "assets": [
        "content",
        "dist",
        "favicon.ico"
    ],

推荐答案

好像您正在使用jhipster一样,它仅部分支持角度cli(

Looks like you are using jhipster which is just partly supports angular cli(only for codegeneration purposes). That is why your scripts, assets in your .angular-cli.json not making any effect as jhipster is using its own build chain. So with jhipser you have to do it a bit differently.

您需要使用vendor.ts来引用自定义的cssjs文件.

You need to use vendor.ts where you can reference your custom css and js files.

这篇关于webpack是否打包.angular-cli.json中引用的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆