php - 解析 CSS url 时出现 Webpack 错误

标签 php css laravel webpack

当我在 scss 文件中使用 URL 并在 Vue 组件中使用该文件(使用@import)时,我收到以下错误:

错误:找不到模块“../images/icons/home_grey.svg”

(该路径是相对于我的 scss 源文件的路径)。我怎样才能停止收到该错误?我的 webpack.mix.js 文件当前包含以下几行:

mix.setResourceRoot('/root/'); mix.copyDirectory('resources/assets/images', 'public/images');

最佳答案

也许这是因为如果您使用的是 css-loader,则需要将查询参数“modules”设为 true。这将允许加载程序加载模块。

类似这样的东西,用于 css-loader 选项,

                    options: {
                        modules: true,
                       }

关于php - 解析 CSS url 时出现 Webpack 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46921197/

相关文章:

php - htaccess 文件 : Force going to https instead of http except for specific pages

php无法执行mysql查询转义

javascript - Swiper Center Slide on click 事件

html - IE7无法用边距抵消

laravel - 安装简单的二维码后, Blade 引擎无法在 laravel 5 上运行

mysql - Laravel 5.8/Mysql : Cannot delete or update a parent row a foreign key constraint fails

php - xsl根据数值选择节点

php - 如何在 PHP 和 MySQL 中操作数组?

html - 自动调整背景图像的大小

css - 有没有办法在 laravel 中随机化 css 类