Skip to content
This repository has been archived by the owner on Dec 25, 2018. It is now read-only.

Webpack 3 Chunk.modules deprecation #120

Open
johankvint opened this issue Aug 7, 2017 · 1 comment
Open

Webpack 3 Chunk.modules deprecation #120

johankvint opened this issue Aug 7, 2017 · 1 comment

Comments

@johankvint
Copy link

Hi,

Webpack 3 have deprecated the chunk.modules attribute and when I build I get the following warning from webpack.

I'm using webpack 3.4.1 and purifycss-webpack 0.7.0.

(node:38535) DeprecationWarning: Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.

⚠️  Warnings Plugin


DeprecationWarning

Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.

DeprecationWarning: Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.
    at /Users/abc/webapp/node_modules/purifycss-webpack/dist/index.js:68:31
    at Array.forEach (native)
    at Compilation.<anonymous> (/Users/abc/webapp/node_modules/purifycss-webpack/dist/index.js:65:30)
    at next (/Users/abc/webapp/node_modules/tapable/lib/Tapable.js:204:14)
    at Compilation.<anonymous> (/Users/abc/webapp/node_modules/extract-text-webpack-plugin/dist/index.js:272:11)
    at Compilation.applyPluginsAsyncSeries (/Users/abc/webapp/node_modules/tapable/lib/Tapable.js:206:13)
    at sealPart2 (/Users/abc/webapp/node_modules/webpack/lib/Compilation.js:636:9)
    at next (/Users/abc/webapp/node_modules/tapable/lib/Tapable.js:202:11)
    at /Users/abc/webapp/node_modules/extract-text-webpack-plugin/dist/index.js:241:13
    at /Users/abc/webapp/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/abc/webapp/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:998:13)
    at /Users/abc/webapp/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:906:16
    at /Users/abc/webapp/node_modules/extract-text-webpack-plugin/dist/index.js:224:15
    at /Users/abc/webapp/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/abc/webapp/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:998:13)
    at /Users/abc/webapp/node_modules/extract-text-webpack-plugin/node_modules/async/dist/async.js:906:16
    at /Users/abc/webapp/node_modules/extract-text-webpack-plugin/dist/index.js:213:21
    at rebuilding.forEach.cb (/Users/abc/webapp/node_modules/webpack/lib/Compilation.js:504:29)
    at Array.forEach (native)
    at callback (/Users/abc/webapp/node_modules/webpack/lib/Compilation.js:504:15)
    at processModuleDependencies (/Users/abc/webapp/node_modules/webpack/lib/Compilation.js:523:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

If I change this part in the npm package file dist/index.js:

compilation.plugin('additional-assets', function (cb) {
    // Go through chunks and purify as configured
    compilation.chunks.forEach(function (_ref) {
    var chunkName = _ref.name,
        files = _ref.files,
        modules = _ref.modules;

to use chunk.mapModules instead:

compilation.plugin('additional-assets', function (cb) {
    // Go through chunks and purify as configured
    compilation.chunks.forEach(function (_ref) {
    var chunkName = _ref.name,
        files = _ref.files,
        modules = _ref.mapModules(function (m) {return m;});

The warning disappears.

@tony
Copy link

tony commented Aug 8, 2017

@johankvint that's worth making a PR for

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants