简体   繁体   English

带有Parcel的vue.js项目,但使用图像文件时css文件中有错误

[英]A vue.js project with Parcel ,but there are errors in css file when using images files

This is my project: github . 这是我的项目: github

In app.js: 在app.js中:

import '../static/css/common.css'

I imported 'common.css', then executed the command 'npm run build'(parcel build index.html), that is the result: 我导入了'common.css',然后执行了命令'npm run build'(parcel build index.html),结果如下:

[ [ 在此处输入图片说明]

But if I removed some code from the bottom of common.css like this: 但是,如果我从common.css底部删除了一些代码,例如:

[ [ common.css]

Then execute 'npm run build', there is no error, excuted successfully... 然后执行'npm run build',没有错误,成功执行了...

So I don't know how to import images in css with Parcel.I can't find solutions on Parcel official website. 所以我不知道如何使用Parcel在css中导入图像,我在Parcel官方网站上找不到解决方案。

Please help me,thank you very much! 请帮助我,非常感谢!

Try to add this : 尝试添加以下内容:

if(!this.bundleLoaders){
    this.bundleLoaders = new Set();
}
this.bundleLoaders.add(mod.type);

Here -> \\node_modules\\parcel-bundler\\src\\packagers\\JSPackager.js on line 56 在这里-> \\node_modules\\parcel-bundler\\src\\packagers\\JSPackager.js on line 56

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM