From 58ae2ba21efcd85df331cf996a94038a77302b51 Mon Sep 17 00:00:00 2001
From: Mr Ke <kelq@hugeinfo.com.cn>
Date: Wed, 27 May 2020 17:07:48 +0800
Subject: [PATCH] 修改报错问题
---
.command/.conf/webpack.test.js | 91 +++++++++++++++++++++++----------------------
1 files changed, 47 insertions(+), 44 deletions(-)
diff --git a/.command/.conf/webpack.test.js b/.command/.conf/webpack.test.js
index 556a463..e0e6be4 100644
--- a/.command/.conf/webpack.test.js
+++ b/.command/.conf/webpack.test.js
@@ -1,37 +1,41 @@
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
-const HtmlWebpackPlugin = require('html-webpack-plugin');
-const CopyWebpackPlugin = require('copy-webpack-plugin');
-const webpack = require('webpack');
-const path = require('path');
-const fs = require('fs');
+const HtmlWebpackPlugin = require("html-webpack-plugin");
+const CopyWebpackPlugin = require("copy-webpack-plugin");
+const webpack = require("webpack");
+const path = require("path");
+const fs = require("fs");
-const rules = [{
- test: /\.(js|jsx)$/i,
- loader: 'babel-loader'
-}, {
- test: /\.css$/i,
- use: [MiniCssExtractPlugin.loader, 'css-loader']
-}, {
- test: /\.s[ac]ss$/i,
- use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
-}, {
- test: /\.less$/i,
- use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader']
-}, {
- test: /\.(svg|png|jpg|gif)$/i,
- loader: 'file-loader',
- options: {
- name: '[name].[ext]?[hash]',
- outputPath: 'static/'
+const rules = [
+ {
+ test: /\.(js|jsx)$/i,
+ loader: "babel-loader"
+ },
+ {
+ test: /\.css$/i,
+ use: [MiniCssExtractPlugin.loader, "css-loader"]
+ },
+ {
+ test: /\.s[ac]ss$/i,
+ use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"]
+ },
+ {
+ test: /\.less$/i,
+ use: [MiniCssExtractPlugin.loader, "css-loader", "less-loader"]
+ },
+ {
+ test: /\.(svg|png|jpg|gif|ttf|css)$/i,
+ loader: "file-loader",
+ options: {
+ name: "[name].[ext]?[hash]",
+ outputPath: "static/"
+ }
}
-}];
-
-
+];
const plugins = [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
- template: './src/conf/index.html',
+ template: "./src/conf/index.html",
minify: true
}),
new MiniCssExtractPlugin({
@@ -39,24 +43,23 @@
})
];
-if (fs.existsSync(path.resolve(__dirname, './src/copy'))) {
- plugins.push(new CopyWebpackPlugin([{
- to: path.resolve(__dirname, './dist-debug'),
- from: './src/copy',
- toType: 'dir'
- }]));
+if (fs.existsSync(path.resolve(__dirname, "./src/copy"))) {
+ plugins.push(
+ new CopyWebpackPlugin([
+ {
+ to: path.resolve(__dirname, "./dist-debug"),
+ from: "./src/copy",
+ toType: "dir"
+ }
+ ])
+ );
}
-
module.exports = {
- entry: [
- './src/conf/reset.scss',
- './src/index.jsx',
- './src/conf/cover.scss'
- ],
+ entry: ["./src/conf/reset.scss", "./src/index.jsx", "./src/conf/cover.scss"],
output: {
- path: path.resolve(__dirname, './dist-debug'),
- filename: 'index.js?[hash]'
+ path: path.resolve(__dirname, "./dist-debug"),
+ filename: "index.js?[hash]"
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"]
@@ -65,10 +68,10 @@
rules
},
devServer: {
- contentBase: './dist-debug',
+ contentBase: "./dist-debug",
hot: true
},
- mode: 'development',
- devtool: 'inline-source-map',
+ mode: "development",
+ devtool: "inline-source-map",
plugins
};
--
Gitblit v1.8.0