小编dam*_*era的帖子

图像未加载到 webpack 中 + 图像输出文件夹之外还有另一个图像

图像未加载到 webpack 中,+图像输出文件夹之外还有另一个图像。

我尝试了很多解决方案,但没有成功。在第二张图片中,有一个导出标签“export default "./media/hero-bg.png";” 在构建文件夹索引 Html webpack 中,使用另一个哈希名称在构建文件夹之外添加了图像。

const path = require("path")
const react = require("react")
const webpack = require("webpack")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
    entry: {
        menu: ['babel-polyfill', './src/index.js'],
        main:'./index.js'
    },
    output:{
        path: path.resolve(__dirname, 'build'),
        assetModuleFilename: "[name].[ext]",
    },
    // devtool:"inline-source-map",
    devServer:{
        port: 3130,
        static: true,
    },
    module: {
        rules: [
            {
                test: /\.m?js$|jsx/,
                exclude: /node_module/,
                use: {
                    loader:"babel-loader",
                    options: { presets: ['@babel/preset-env','@babel/preset-react']},
                    
                },
            },
            {
                test: /\.css$/, …
Run Code Online (Sandbox Code Playgroud)

html javascript backend webpack

6
推荐指数
0
解决办法
399
查看次数

标签 统计

backend ×1

html ×1

javascript ×1

webpack ×1