webpack错误:要导入的文件未找到或不可读:波本威士忌,如何修复?

时间:2018-02-23 22:43:18

标签: javascript angular webpack-2 webpack-3

我正在尝试在我的SCSS文件中加载Bourbon包。我使用的是Angular 2,这是我的webpack 3.0配置:

var path = require("path");
var webpack = require("webpack");

module.exports = {
  devServer: {
    contentBase: path.join(__dirname, "build"),
    compress: true,
    port: 9000
  },
  node: {
    fs: 'empty'
  },
  cache: true,
  devtool: "eval", //or cheap-module-eval-source-map
  entry: {
    app: path.join(__dirname, "client/app", "app.js")
  },
  output: {
    path: path.join(__dirname, "buildf"),
    filename: "ha.js",
    chunkFilename: "[name].js"
  },
  plugins: [
    //Typically you'd have plenty of other plugins here as well
    new webpack.DllReferencePlugin({
      context: path.join(__dirname, "client"),
      manifest: require("./build/vendor-manifest.json")
    }),
  ],
  module: {
    loaders: [
      {
        test: /\.js?$/,
        loader: "babel-loader",
        include: [
          path.join(__dirname, "client") //important for performance!
        ],
        exclude: [
          path.join(__dirname, "node_modules")
        ],
        query: {
          cacheDirectory: true, //important for performance
          plugins: ["transform-regenerator"],
          presets: ["es2015", "stage-0"]
        }
      },

      { test: /\.(scss|sass)$/, loader: ['style-loader', 'css-loader', 'sass-loader'] },
      { test: /\.html$/, loader: 'raw-loader' },
      { test: /\.css$/, loader: 'css-loader' }
    ]
  }
};

当我运行webpack时,我收到此错误:

  

错误   ./node_modules/css-loader!./node_modules/sass-loader!./client/app/app.scss   模块构建失败:@ import" bourbon&#34 ;; ^         要导入的文件未找到或不可读:波本威士忌。父样式表:stdin         在/Users/john/NG6-starter/client/app/app.scss(第2行,第1列)@ ./client/app/app.scss 4:14-116 @ ./client/app/app.component。 JS   @ ./client/app/app.js @ multi   (webpack)-dev-server / client?http://localhost:9000 ./client/app/app.js   webpack:无法编译。

为什么找不到波旁威士忌成分?以下是code

的链接

0 个答案:

没有答案