Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useCompilerPath option should respect webpack@5 defaults #403

Open
Den-dp opened this issue May 14, 2021 · 0 comments · May be fixed by #405
Open

useCompilerPath option should respect webpack@5 defaults #403

Den-dp opened this issue May 14, 2021 · 0 comments · May be fixed by #405

Comments

@Den-dp
Copy link
Contributor

Den-dp commented May 14, 2021

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

Den-dp added a commit to Den-dp/assets-webpack-plugin that referenced this issue May 17, 2021
…ject

This change helps for cases when `useCompilerPath` option is used, but `output.path` is not defined (since it is optional https://webpack.js.org/migrate/5/?_sm_au_=iVVn83n2sDMW0RFrMjpfkK68cqsfp#clean-up-configuration )

Closes: ztoben#403
Den-dp added a commit to Den-dp/assets-webpack-plugin that referenced this issue Jun 23, 2021
…ject

This change helps for cases when `useCompilerPath` option is used, but `output.path` is not defined (since it is optional https://webpack.js.org/migrate/5/?_sm_au_=iVVn83n2sDMW0RFrMjpfkK68cqsfp#clean-up-configuration )

Closes: ztoben#403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant