night-cherry преди 3 седмици
родител
ревизия
4bf6fd8fc7
променени са 1 файла, в които са добавени 18 реда и са изтрити 32 реда
  1. 18 32
      webpack.config.js

+ 18 - 32
webpack.config.js

@@ -4,7 +4,7 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
 const HtmlWebpackPlugin = require('html-webpack-plugin');
 //const { VueLoaderPlugin } = require('vue-loader/dist/index');
 const { VueLoaderPlugin } = require('vue-loader');
-const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+
 
 module.exports={
   entry:{
@@ -21,37 +21,27 @@ module.exports={
   },
   module:{
     rules:[
-      // {
-      //   test: /\.html  \)/,
-      //   use: [
-      //     {
-      //       loader: 'html-loader',
-      //       options: {  // [!code focus]
-      //         // 配置 HTML 中资源引用的处理规则
-      //         sources: { // [!code focus]
-      //           list: [ // [!code focus]
-      //             { tag: 'img', attribute: 'src', type: 'src' }, // 处理 <img src>
-      //             { tag: 'a', attribute: 'href', type: 'src' }   // 处理 <a href> // [!code focus]
-      //           ] // [!code focus]
-      //         } // [!code focus]
-      //       } // [!code focus]
-      //     }
-      //   ]
-      // },
       {
-        test:/\.css$/i,
-        // use:["style-loader","css-loader"],
-         use: [
-          MiniCssExtractPlugin.loader,
+        test: /\.html  \)/,
+        use: [
           {
-            loader: 'css-loader',
-            options: {
-              // 重点:将 CSS 输出到对应入口的 css 目录
-              outputPath: 'css/'  
-            }
+            loader: 'html-loader',
+            options: {  // [!code focus]
+              // 配置 HTML 中资源引用的处理规则
+              sources: { // [!code focus]
+                list: [ // [!code focus]
+                  { tag: 'img', attribute: 'src', type: 'src' }, // 处理 <img src>
+                  { tag: 'a', attribute: 'href', type: 'src' }   // 处理 <a href> // [!code focus]
+                ] // [!code focus]
+              } // [!code focus]
+            } // [!code focus]
           }
         ]
       },
+      {
+        test:/\.css$/i,
+        use:["style-loader","css-loader"],
+      },
      {
       test:/\.vue$/,
       use:[
@@ -70,7 +60,7 @@ module.exports={
       }
     },
     {
-     test:/\.(png|jpe?g|gif|svg|webp)$/i,
+     test:/\.(png|jpe?g|gif|svg)$/i,
     //  use:[{ 
     //   loader:"file-loader",
     //   options:{
@@ -110,10 +100,6 @@ module.exports={
       filename:"index.html",
       chunks:['index'],
     }),
-    new MiniCssExtractPlugin({
-      // CSS 输出到对应入口的 css 目录
-      filename: './style/[name].[contenthash:8].css'  
-    }),
   ],
   // 优化配置(如代码拆分)
   optimization: {