Skip to content

How to make it work with webpack and webpack-dev-server #80

@maxgalbu

Description

@maxgalbu

I'm using webpack-dev-server to avoid having to refresh the extension popup page, so I'm not currently starting webpack with webpack -w but with the following code:

var compiler = webpack(configs);
var server = new WebpackDevServer(
    {
        https: false,
        hot: false,
        client: false,
        host: 'localhost',
        port: PORT,
        static: {
            directory: join(__dirname, '../build'),
        },
        devMiddleware: {
            publicPath: `http://localhost:${PORT}/`,
            writeToDisk: true,
        },
        headers: {
            'Access-Control-Allow-Origin': '*',
        },
        allowedHosts: 'all',
    },
    compiler
);

Is it possible to make web-ext run work with the above configuration?

Activity

birtles

birtles commented on Nov 29, 2023

@birtles
Collaborator

I'm afraid I'm not familiar with how webpack-dev-server differs from webpack -w.

I use webpack -w and it automatically reloads the options page and re-injects the content scripts, at least on Firefox.

GabenGar

GabenGar commented on Mar 11, 2024

@GabenGar

You have writeToDisk option enabled and that means you can point to the html file in your manifest which gets fed to webpack-dev-server.
And yes, it does mean you'll have to manage slightly different manifests for development and production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @birtles@maxgalbu@GabenGar

        Issue actions

          How to make it work with webpack and webpack-dev-server · Issue #80 · hiikezoe/web-ext-webpack-plugin