R
R
Roman2018-08-01 13:02:33
JavaScript
Roman, 2018-08-01 13:02:33

DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead, how to fix?

(node:23725) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
TypeError: dep.getResourceIdentifier is not a function
    at addDependency (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:665:30)
    at iterationOfArrayCallback (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:186:3)
    at addDependenciesBlock (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:687:5)
    at Compilation.processModuleDependencies (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:698:4)
    at afterBuild (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:830:15)
    at buildModule.err (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:874:11)
    at callback (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:611:5)
    at module.build.error (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/Compilation.js:651:12)
    at handleParseResult (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/NormalModule.js:441:12)
    at doBuild.err (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/NormalModule.js:463:6)
    at runLoaders (/var/php/www/TC.develop/template/test5/node_modules/webpack/lib/NormalModule.js:327:12)
    at /var/php/www/TC.develop/template/test5/node_modules/loader-runner/lib/LoaderRunner.js:370:3
    at iterateNormalLoaders (/var/php/www/TC.develop/template/test5/node_modules/loader-runner/lib/LoaderRunner.js:211:10)
    at Array.<anonymous> (/var/php/www/TC.develop/template/test5/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
    at Storage.finished (/var/php/www/TC.develop/template/test5/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
    at provider (/var/php/www/TC.develop/template/test5/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
    at /var/php/www/TC.develop/template/test5/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:525:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

package.json
{
  "name": "test5",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {
    "webpack-cli": "^3.1.0"
  },
  "private": true,
  "scripts": {
    "dev-server": "encore dev-server",
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production"
  },
  "dependencies": {
    "@symfony/webpack-encore": "^0.20.1",
    "axios": "^0.18.0",
    "babel-loader": "^7.1.5",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "cross-env": "^5.2.0",
    "css-loader": "^1.0.0",
    "encore": "^0.0.30-beta",
    "node-sass": "^4.9.2",
    "sass-loader": "^7.0.3",
    "vue": "^2.5.16",
    "vue-loader": "^15.2.6",
    "vue-material": "^1.0.0-beta-10.2",
    "vue-server-renderer": "^2.5.16",
    "vue-template-compiler": "^2.5.16",
    "vuex": "^3.0.1",
    "webpack": "^4.16.3"
  }
}

webpack.config.js
var Encore = require('@symfony/webpack-encore');
Encore
    // the project directory where compiled assets will be stored
    .setOutputPath('public/build/')
    // the public path used by the web server to access the previous directory
    .setPublicPath('/build')
    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())

    // create hashed filenames (e.g. app.abc123.css)
    .enableVersioning(Encore.isProduction())

    .enableVueLoader()
    .enableSassLoader()
    .addEntry('js/client', './assets/js/client.js')
    .addEntry('js/server', './assets/js/server.js')

    .configureBabel(function(babelConfig) {
        babelConfig.plugins = ["transform-object-rest-spread"]//, "vue-material"]
    })
;

module.exports = Encore.getWebpackConfig();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Satisfied IT, 2018-08-01
@GUY

General warning, it is recommended to use the new API, the use of Tapable.plugin is not recommended and will be removed soon.
And in the error it is also clearly written that dep.getResourceIdentifierit is not a function, perhaps somewhere a typo.

G
Garguly Magnievich, 2019-05-19
@chuanyurug

Today we need another solution.
https://github.com/webpack/webpack/issues/6568

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question