Skip to content

useCompilerPath option should respect webpack@5 defaults #403

Open

Description

@Den-dp

Is your feature request related to a problem? Please describe.
Since webpack@5 recommends configuration cleanup and output.path removing...

Consider removing defaults:
Using output.path: path.resolve(__dirname, 'dist'): you can omit it, that's the default.

Describe the solution you'd like
...it would be great to properly handle this case (when useCompilerPath option is enabled but no output.path is provided).

Describe alternatives you've considered
Explicitly set output.path is what I'm doing right now, but it feels redundant in webpack@5.

Additional context
Technically saying this is a bug, b/c, if path is not set, webpack-assets.json will be created in the project root ignoring useCompilerPath setting, but I'd like to put it as a feature.

Repro:

const AssetsPlugin = require('assets-webpack-plugin');
const path = require('path');

module.exports = {
    output: {
        // path: path.resolve(__dirname, 'dist') // uncomment to fix
    },
    plugins: [
        new AssetsPlugin({
            useCompilerPath: true,
        })
    ]
};
npm init -y
npm i webpack assets-webpack-plugin webpack-cli -D
npx webpack --mode production

Actual:
webpack-assets.json created in project's root

Expected:
webpack-assets.json created in dist, since useCompilerPath should respect webpack@5 defaults

Activity

  1. added a commit that references this issue on May 17, 2021
    a3d761a
  2. added a commit that references this issue on Jun 23, 2021
    c6323bc
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

      Issue actions