On the packing problem of iview-cli

problem description

items produced with iview-cli do not know what to do after packaging, and index_prod.html accesses blank

the environmental background of the problems and what methods you have tried

the earlier vue project package is different from this packaged file, and the access method is also different.

related codes

this is the webpack.prod.config.js file
/ / Please paste the code text below (do not replace the code with pictures)


const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const merge = require("webpack-merge");
const webpackBaseConfig = require("./webpack.base.config.js");
const fs = require("fs");

fs.open("./src/config/env.js", "w", function(err, fd) {
    const buf = "export default "production";";
    fs.write(fd, buf, 0, buf.length, 0, function(err, written, buffer) {});
});

module.exports = merge(webpackBaseConfig, {
    output: {
        publicPath: "/dist/",
        filename: "[name].[hash].js",
        chunkFilename: "[name].[hash].chunk.js"
    },
    plugins: [
        new ExtractTextPlugin({
            filename: "[name].[hash].css",
            allChunks: true
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: "vendors",
            filename: "vendors.[hash].js"
        }),
        new webpack.DefinePlugin({
            "process.env": {
                NODE_ENV: ""production""
            }
        }),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false
            }
        }),
        new HtmlWebpackPlugin({
            filename: "../index_prod.html",
            template: "./src/template/index.ejs",
            inject: false
        })
    ]
});

what result do you expect? What is the error message actually seen?

this is the dist folder that is packaged and accessed using iview-cli and generated

clipboard.png

clipboard.png

:

clipboard.png

I will preview the packaged project before launching, and you can visit

using http-server.

but now I don"t know how to start with the package that comes from the iview-cli project. I hope you can help me solve it. Thank you

.
Mar.29,2021

you should want js to be packed in the dist/static/js folder, and css in dist/static/css , right
output's filename and chunkFilename plus path

output: {
        publicPath: '/dist/',
        filename: 'static/js/[name].[hash].js',
        chunkFilename: 'static/js/[name].[hash].chunk.js'
    },
static/css

on the output machine of

css

Menu