Skip to content

Installing plugin and renaming index.html - plugin doesn't seem to work / load. #2575

Open
@hvitis

Description

@hvitis

Hello

I am trying to create custom plugin that uses vuepress-html-webpack-plugin.
The goal is to rename the final index.html file to test.html. I need it for NGINX and Django&Gunicorn hosting.

const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
    entry: "index.js",
    output: {
        path: __dirname + "/build",
        filename: "index_bundle.js"
    },
    template:
        "~/repo/build/test.html",
    plugins: [new HtmlWebpackPlugin()]
};

The plugin doesn't seem to work. The compilation passes through the code and nothing happens with the index.html name. (It can change the folder name but not the file). I've been trying to use chainWebpack:

const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
    chainWebpack: config => {
        config.plugin("html").tap(args => {
            args[0].template =
                "/Users/hvitis/Programming/FullStack/venvToBePrint3D.com/ToBePrint3D/test/test.html";
            return args;
        });
    },
};

but I'm getting:

error vuepress-plugin-anonymous-b4e05e02 apply chainWebpack failed.
Error: Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.

Any idea on how could I load the plugin before tap?
Any other ideas on how could I force build process to name index.html differently?
Virtualy no other method has worked with VuePress... including ejecting.

Thank you


Metadata

Metadata

Assignees

No one assigned

    Labels

    need feedbackAwaiting author responsetype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions