shellscape / webpack-manifest-plugin

webpack plugin for generating asset manifests
MIT License
1.43k stars 186 forks source link

Webpack v5 Support Plan #222

Closed shellscape closed 3 years ago

shellscape commented 3 years ago

Hey folks! :wave:

For those who don't already know, I've stepped in as maintainer of this fantastic plugin. I wanted to share my plan with you all about support for Webpack v5 and how we're going to go about it. To begin, I'm focusing on getting the plugin updated for Webpack v4. That includes fixes, features, documentation, and updates. While the webpack team has had v5 in beta and release-candidate for a long while, it's prudent to wait until v5 has been out for a while and we're ensured that it has stabilized. If webpack v4 taught us anything, adopting a new major version early may end up in playing whack-a-mole in plugins. To that end...

Maintenance

First things first, I'm working to get the plugin metadata and supporting code updated all-around. That includes:

Open Pull Requests

I'll be taking a look at the current state of all open pull requests. Focus is going to be on fixes, features, and updates for Webpack v4 initially. PRs for webpack v5 compatibility will be labeled for webpack v5 and locked. This will be temporary.

Open Issues

Pretty much the same approach as Pull Requests.

Documentation

The documentation needs ❤️ so it'll be getting some.

And Then

Once we've done all of the above for Webpack v4, we'll spin up a next branch with Webpack v5 fixes. Depending on the adoption rate for v5 we'll merge next into master and support both v4 and v5, or release a new major for v5 support. We'll see how that goes.

For now, you can follow along on the life-support branch to view updates on the Maintenance stage. Once that stage is complete, that'll be merged to master and the real fun begins.

kirill-konshin commented 3 years ago

Just in case, v5 is out.

shellscape commented 3 years ago

Yes, we're aware.

brianwozeniak commented 3 years ago

I am using 3.0.0-rc.0 with Webpack 5.1.3 and seems to be working correctly. The main issue I see at least with my setup is that I believe the following warnings are from this package:

(node:25952) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader

(node:25952) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.chunks was changed from Array to Set (using Array method 'reduce' is deprecated)
shellscape commented 3 years ago

Please note this is not a support thread for current RCs. Appreciate the note, but we'll be looking at v5 support wholesale, after considering and evaluating previous attempts from v5 betas.

firsovdevelop commented 3 years ago

I have a problem naming files inside a manifest. The prefix "auto" is automatically added. I'm using webpack 5. { "libs.js": "autolibs.js", "app.js": "autoapp.js" } How can this be corrected?

juliusdelta commented 3 years ago

@shellscape I've been looking for a small project to get deeply involved with and we use this plugin at my day job so I'd love to assist anyway I can. Just let me know what I can do to help. Is the Gitter channel active still?

shellscape commented 3 years ago

@juliusdelta would love help, thank you for volunteering. I'm not sure about the Gitter channel for webpack, but when I did pop in there, there were still people posting questions. Where we can use immediate help is going through the older issues to see if they're still relevant. Once I get v3 out the door, we'll be more open to contributions as well


Good news. I have the life-support branch where I want to see it and I'll be merging that to master in the next few days. Next steps are to address all open pull requests (which don't reference webpack@5 that is). Once those are address/merged/closed, I'll release v3 and we'll build on it from there. Webpack is still releasing fixes and updated to version 5, so it's not yet stable.

max-degterev commented 3 years ago

Hi guys, do you have any timeframe for when webpack v5 support might be released?

shellscape commented 3 years ago

Webpack is still releasing fixes and updated to version 5, so it's not yet stable.

Once I'm confident that v5 is stable. They've had 5 minor versions released already. I'm somewhat confident that there won't be any breaking changes, but the fixes they're releasing are changing the workaround and such that plugin authors are relying on, which is kind of breaking (but not breaking according to semver).

My guess is early December.

shellscape commented 3 years ago

There are still several critical v5 bugs that are affecting plugins like html-webpack-plugin, but I'm open to starting to implement support officially. There is some infrastructure to apply for testing on both versions, and some fixes to backport from archive/next. I've also merged in several pending PRs that add some requested features from the past. Look for a new version soon.

shellscape commented 3 years ago

v3.0.0 (728e431) is published and supports Webpack v5

tqma113 commented 3 years ago

May I know when will you update @types/webpack-manifest-plugin?

shellscape commented 3 years ago

That's not my project, so I can't speak to that. I suggest reaching out to the author.

andersk commented 3 years ago

@tqma113 @types/webpack-manifest-plugin is part of DefinitelyTyped, which has its own maintenance structure. I’ve sent a PR to DefinitelyTyped/DefinitelyTyped#50049.

PRISMAY commented 3 years ago

I found a posted issue which is the same one I'm running into that had a link to this thread but am not sure how to fix it still. I'm using webpack-manifest-plugin. When I run "npm run build" I get the error below. I've installed the latest of everything, i.e., webpack, webpack-cli, etc.

[webpack-cli] TypeError: Cannot read property 'length' of undefined at C:\TFS\Project\Sandbox\ReactJS Integration\Main\web\node_modules\webpack-manifest-plugin\lib\plugin.js:129:39 at Array.reduce (<anonymous>) at ManifestPlugin.<anonymous> (C:\TFS\Project\Sandbox\ReactJS Integration\Main\web\node_modules\webpack-manifest-plugin\lib\plugin.js:116:26) at Hook.eval [as callAsync] (eval at create (C:\TFS\Project\Sandbox\ReactJS Integration\Main\web\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\TFS\Project\Sandbox\ReactJS Integration\Main\web\node_modules\tapable\lib\Hook.js:18:14) at Compiler.emitAssets (C:\TFS\Project\Sandbox\ReactJS Integration\Main\web\node_modules\webpack\lib\Compiler.js:736:19) at C:\TFS\Project\Sandbox\ReactJS Integration\Main\web\node_modules\webpack\lib\Compiler.js:395:10 at processTicksAndRejections (internal/process/task_queues.js:75:11)

joshkel commented 3 years ago

@PRISMAY Are you sure you're using the latest versions of everything? That stack trace (node_modules\webpack-manifest-plugin\lib\plugin.js) makes it look like it's using webpack-manifest-plugin v2.x, not v3.x. You need to run at least v3.0.0 to have Webpack 5 support.

PRISMAY commented 3 years ago

Hi Josh, you're right. I just checked again and I wasn't. I reran npm to update and now am getting the error below. My package.json has the updates now: "webpack": "^5.27.2", "webpack-cli": "^4.5.0", "webpack-manifest-plugin": "^3.1.0", "webpack-nano": "^1.1.1"

[webpack-cli] Failed to load 'C:\TFS\Project\Sandbox\Project ReactJS Integration\Main\ProjectWeb\Scripts\ProjectReact\config\webpack.config.js' config [webpack-cli] TypeError: ManifestPlugin is not a constructor at Object.<anonymous> (C:\TFS\Project\Sandbox\Project ReactJS Integration\Main\ProjectWeb\Scripts\ProjectReact\config\webpack.config.js:55:3) at Module._compile (C:\TFS\Project\Sandbox\Project ReactJS Integration\Main\ProjectWeb\node_modules\v8-compile-cache\v8-compile-cache.js:192:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (C:\TFS\Project\Sandbox\Project ReactJS Integration\Main\ProjectWeb\node_modules\v8-compile-cache\v8-compile-cache.js:159:20) at loadConfig (C:\TFS\Project\Sandbox\Project ReactJS Integration\Main\ProjectWeb\node_modules\webpack-cli\lib\webpack-cli.js:1158:31) at C:\TFS\Project\Sandbox\Project ReactJS Integration\Main\ProjectWeb\node_modules\webpack-cli\lib\webpack-cli.js:1245:74 at Array.map (<anonymous>)

PRISMAY commented 3 years ago

If it'll help, here's what I have in the webpack.config.js that's used in the plugins section.

const ManifestPlugin = require('webpack-manifest-plugin');
const manifestOptions = {
    fileName: 'asset-manifest.json',
    generate: (seed, files) =>
    {
        const manifestFiles = files.reduce((manifest, file) =>
        {
            manifest[file.name] = file.path;
            return manifest;
        }, seed);

        const entrypointFiles = files.filter(x => x.isInitial && !x.name.endsWith('.map')).map(x => x.path);

        return {
            files: manifestFiles,
            entrypoints: entrypointFiles,
        };
    },
};
joshkel commented 3 years ago

@PRISMAY The import style changed for webpack-manifest-plugin v3:

const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
new WebpackManifestPlugin(...)

(We're probably straying out of the "Webpack v5 Support Plan" and into "Support, Help, and Advice" at this point - the project docs suggest that https://gitter.im/webpack/webpack or https://stackoverflow.com/questions/tagged/webpack are better forums.)

PRISMAY commented 3 years ago

Thanks. I just noticed that over at webpack-manifest-plugin. I'm now moving forward. Different errors but I can post them at the support site. Thank you much.