0

在这方面严重需要帮助,拜托!我在使用 bootstrap ^5.1.1 学习 webpack ^5.55.1 时编译 Bootstrap 5 面临严峻挑战(没有反应,vue .. 在这个阶段什么都没有)。开发编译没问题,但在生产模式下构建时失败(附截图)。它不指向任何特定文件,index.sass:1:8744而只是导入一些 bootstrap.scss 文件。

我在下面提供一切必要的东西。哪位大侠能帮帮我!虽然我不好意思提出这么长的问题,但我们强烈要求任何帮助,我们将不胜感激。

Package.json脚本:

"build-dev": "cross-env NODE_ENV=development webpack --stats-children", 
"build": "cross-env NODE_ENV=production webpack"

(我发现还有一个症状:wcript“build”每次都失败,但脚本“build-dev”在我尝试使用 sassOptions{} 缩小输出 CSS 时也失败。我希望这个信息有助于解决它反正。)

Webpack.config.js (sass 规则):

rules: [
      {
        test: /\.s[ac]ss$/i,
        use: [
          MiniCssExtractPlugin.loader,
          {
            loader: "css-loader",
          },
          "postcss-loader",
          {
            loader: "sass-loader",
            options: {
              sassOptions: {
                includePaths: [
                  path.join(__dirname, "node_modules"),
                  path.join(__dirname, "./src/styles/sass"),
                ],
              },
            },
          },
        ],
      },
...]

plugins: [
    new MiniCssExtractPlugin({
      filename: "css/[name].css",
      chunkFilename: "[id].css",
    }),
...]

网站.js

import "../styles/index.sass";
import funcParentNavigation from "./bl01-navigation.js";

糟糕的索引.sass

/*! Bootstrap Essentials */
@import node_modules/bootstrap/scss/functions
@import node_modules/bootstrap/scss/variables
@import node_modules/bootstrap/scss/mixins
@import node_modules/bootstrap/scss/utilities

/*! Bootstrap Layout & components */
@import node_modules/bootstrap/scss/root
@import node_modules/bootstrap/scss/reboot
@import node_modules/bootstrap/scss/type

最后,错误: 在此处输入图像描述

4

0 回答 0